提交时间:2024-04-04 21:08:24
运行 ID: 28193
#include <bits/stdc++.h> using namespace std; #define int long long int n,k; bool ok=0; vector<int>g[100]; inline bool dfs(int u,int fa){ bool rem=1; for(int v:g[u]) if(v!=fa){ if(dfs(v,u)){ if(rem)rem=0; else ok=0; } } return rem; } signed main(){ ios::sync_with_stdio(0); int t; cin>>t; while(t--){ cin>>n>>k; ok=1; for(int i=1;i<=n;i++) g[i].clear(); for(int i=1;i<n;i++){ int u,v; cin>>u>>v; g[u].push_back(v); g[v].push_back(u); } ok=(!dfs(1,0))&ok; if(!ok)cout<<"Alice"<<endl; else if(k>=(n-1)-n/2)cout<<"Bob"<<endl; else cout<<"Alice"<<endl; } cout.flush(); return 0; }