QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#391149 | #7786. Graft and Transplant | Unknown1508 | WA | 1ms | 3808kb | C++14 | 466b | 2024-04-16 14:07:04 | 2024-04-16 14:07:04 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
void main_program();
signed main(){
ios_base::sync_with_stdio(0); cin.tie(0);
main_program();
}
void main_program(){
int n; cin >> n;
vector<int> v(n);
for (int i = 0; i < n-1; i++){
int x, y; cin >> x >> y;
x--; y--;
v[x]++; v[y]++;
}
int cnt = 0;
for (int i = 0; i < n; i++) cnt += (v[i] == 1);
int rem = n - cnt;
if (rem % 2) cout << "Bob\n";
else cout << "Alice\n";
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3592kb
input:
4 1 2 2 3 3 4
output:
Alice
result:
ok "Alice"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
4 1 2 1 3 1 4
output:
Bob
result:
ok "Bob"
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3556kb
input:
2 1 2
output:
Alice
result:
wrong answer 1st words differ - expected: 'Bob', found: 'Alice'