QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#768582 | #7786. Graft and Transplant | mobbb | WA | 0ms | 3808kb | C++20 | 472b | 2024-11-21 12:38:21 | 2024-11-21 12:38:21 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
int main(){
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n;
std::cin >> n;
std::vector<int> dag(n);
for (int i = 0; i < n - 1; i++){
int x, y;
std::cin >> x >> y;
x--, y--;
dag[x]++, dag[y]++;
}
int ans = 0;
for (int i = 0; i < n; i++){
ans += (dag[i] == 1);
}
if (ans % 2 == 0){
std::cout << "Alice\n";
}else{
std::cout << "Bob\n";
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3788kb
input:
4 1 2 2 3 3 4
output:
Alice
result:
ok "Alice"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3520kb
input:
4 1 2 1 3 1 4
output:
Bob
result:
ok "Bob"
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3808kb
input:
2 1 2
output:
Alice
result:
wrong answer 1st words differ - expected: 'Bob', found: 'Alice'