QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#660500#7786. Graft and Transplantiokanux#WA 0ms3848kbC++20679b2024-10-20 11:41:502024-10-20 11:41:50

Judging History

你现在查看的是最新测评结果

  • [2024-10-20 11:41:50]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3848kb
  • [2024-10-20 11:41:50]
  • 提交

answer

#pragma GCC optimize(O2)
#include<bits/stdc++.h>
#define int long long 
using namespace std;
                    
void solve(){
     int n;cin>>n;
     vector<vector<int>>g(n+1);
     for(int i=1;i<n;i++){
        int u,v;cin>>u>>v;
        g[u].push_back(v);
        g[v].push_back(u);
     }
     vector<int>ans(n+1,0);
     int ok=0;
     for(int i=1;i<=n;i++){
        ans[i]=n-1-g[i].size();   
        if(ans[i]&1) ok=1;
     }
     cout<<(ok?"Alice":"Bob");
}
                   
signed main(){
   ios::sync_with_stdio(false);
   cin.tie(nullptr);cout.tie(nullptr);
   int T=1; 
   //cin>>T;
   while(T--){
      solve();
   }
   return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3600kb

input:

4
1 2
2 3
3 4

output:

Alice

result:

ok "Alice"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3848kb

input:

2
1 2

output:

Bob

result:

ok "Bob"

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 3572kb

input:

3
1 2
1 3

output:

Alice

result:

wrong answer 1st words differ - expected: 'Bob', found: 'Alice'