QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#281187#7786. Graft and Transplantucup-team139#WA 0ms3440kbC++23558b2023-12-09 22:58:422023-12-09 22:58:42

Judging History

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

  • [2023-12-09 22:58:42]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3440kb
  • [2023-12-09 22:58:42]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

void solve(int t){
    int n;
    cin>>n;
    
    
    vector deg(n+1,0);
    for(int i=0;i<n-1;i++){
        int u,v;
        cin>>u>>v;
        deg[u]++;
        deg[v]++;
    }
    
    int cont=0;
    for(int i=1;i<=n;i++){
        if(deg[i]>1)cont++;
    }
    cont--;
    
    cout<<(cont%2==0 ? "Bob" : "Alice")<<"\n";
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int t=1;
    //cin>>t;
    for(int i=1;i<=t;i++)solve(i);
    
    return 0;
}

详细

Test #1:

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

input:

4
1 2
2 3
3 4

output:

Alice

result:

ok "Alice"

Test #2:

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

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

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

input:

2
1 2

output:

Alice

result:

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