QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#750297 | #7786. Graft and Transplant | s1amese | WA | 0ms | 3636kb | C++20 | 441b | 2024-11-15 13:57:07 | 2024-11-15 13:57:07 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> g(n);
for (int i = 0; i < n - 1; i++) {
int u, v;
cin >> u >> v;
--u, --v;
g[u]++, g[v]++;
}
for (int i = 0; i < n; i++) {
if (g[i] == n - 1) {
cout << "Bob\n";
return 0;
}
}
for (int i = 0; i < n; i++) {
if ((n - 1 - g[i]) & 1) {
cout << "Alice\n";
return 0;
}
}
cout << "Bob\n";
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3536kb
input:
4 1 2 2 3 3 4
output:
Alice
result:
ok "Alice"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
4 1 2 1 3 1 4
output:
Bob
result:
ok "Bob"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3488kb
input:
2 1 2
output:
Bob
result:
ok "Bob"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
3 1 2 1 3
output:
Bob
result:
ok "Bob"
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 3484kb
input:
5 2 1 2 3 3 4 1 5
output:
Alice
result:
wrong answer 1st words differ - expected: 'Bob', found: 'Alice'