Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
28191 liuyile 【BJ】T2 C++ 通过 100 3 MS 280 KB 611 2024-04-04 21:07:04

Tests(20/20):


#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&&dfs(v,u))rem?rem=0: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,u,v;i<n;i++)cin>>u>>v,g[u].push_back(v),g[v].push_back(u); if(dfs(1,0))ok=0; if(!ok)cout<<"Alice"<<endl; else if(k>=(n-1)-n/2)cout<<"Bob"<<endl; else cout<<"Alice"<<endl; } cout.flush(); return 0; }


测评信息: