QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#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;
}
Details
Tip: Click on the bar to expand more detailed information
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'