Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
28193 | liuyile | 【BJ】T2 | C++ | 通过 | 100 | 3 MS | 280 KB | 686 | 2024-04-04 21:08:24 |
#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; }