QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#666848#7786. Graft and Transplantnjupt_zyWA 1ms6024kbC++17726b2024-10-22 20:11:262024-10-22 20:11:33

Judging History

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

  • [2024-10-22 20:11:33]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:6024kb
  • [2024-10-22 20:11:26]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl "\n"
template<typename T>
void read(T &t){
    t=0;int flag=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')flag=-1;c=getchar();}
    while(c>='0'&&c<='9'){t=(t<<3)+(t<<1)+c-'0';c=getchar();}
    t=t*flag;
}
const int N=1e5+5;
vector<int> p[N];
int du[N];
int main(){
    int n;cin>>n;
    for(int i=1;i<n;i++){
        int x,y;cin>>x>>y;
        p[x].push_back(y);
        p[y].push_back(x);
        du[x]++;du[y]++;
    }
    if(n==2)cout<<"Bob"<<endl;
    int ans=0;
    for(int i=1;i<=n;i++){
        if(du[i]!=1)ans++;
    }
    if(ans%2==0)cout<<"Alice"<<endl;
    else cout<<"Bob"<<endl;
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 6024kb

input:

4
1 2
2 3
3 4

output:

Alice

result:

ok "Alice"

Test #2:

score: 0
Accepted
time: 1ms
memory: 5880kb

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

score: -100
Wrong Answer
time: 1ms
memory: 5944kb

input:

2
1 2

output:

Bob
Alice

result:

wrong answer Participant output contains extra tokens