QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#376666#7786. Graft and TransplantzhouyidieWA 0ms3712kbC++17646b2024-04-04 14:52:292024-04-04 14:52:30

Judging History

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

  • [2024-04-04 14:52:30]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3712kb
  • [2024-04-04 14:52:29]
  • 提交

answer

#include<bits/stdc++.h>
typedef long long LL ;
using namespace std;
const int N = 1e6 + 5 ;
LL  n;
int e[N];

void AC(){
    cin >> n;
    for(int i = 1; i < n; ++i) {
        int u, v;
        cin >> v >> u ;
        e[ v ] ++ ;
        e[ u ] ++ ;
    }
    int cnt = 0 ;
    for(int i = 1; i <= n ; i++ ){
        if( e[ i ] != 1 ){
            cnt++ ;
        }
    }
    if( cnt & 1 ){
        cout << "Bob\n";
    }else{
        cout << "Alice" ;
    }
}

signed main(){

    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int t = 1;
    //cin >> t;
    while(t --){
        AC();
    }
}

详细

Test #1:

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

input:

4
1 2
2 3
3 4

output:

Alice

result:

ok "Alice"

Test #2:

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

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

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

input:

2
1 2

output:

Alice

result:

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