Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
28186 | liuyile | 【BJ】T2 | C++ | 解答错误 | 10 | 3 MS | 284 KB | 783 | 2024-04-04 20:48:23 |
#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=ok&!dfs(1,0); if(!ok)cout<<"Alice"<<endl; else if(k>=(n-1)-n/2)cout<<"Bob"<<endl; else cout<<"Alice"<<endl; } cout.flush(); return 0; } /* 7 1 2 1 3 1 4 1 5 1 6 1 7 3 2 3 4 5 6 7 5 1 2 2 3 2 4 2 5 2 3 5 1 4 */