QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#325180 | #7786. Graft and Transplant | ZhouShang# | WA | 0ms | 3600kb | C++17 | 223b | 2024-02-11 05:29:40 | 2024-02-11 05:29:41 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int n,m,x,y,d[1<<20];
int main(){
cin>>n,m=n-1;
for(int i=1;i<n;i++)
cin>>x>>y,d[x]++,d[y]++;
for(int i=1;i<=n;i++)
m-=d[i]==1;
cout<<(m&1?"Alice\n":"Bob\n");
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3600kb
input:
4 1 2 2 3 3 4
output:
Alice
result:
ok "Alice"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
4 1 2 1 3 1 4
output:
Bob
result:
ok "Bob"
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3580kb
input:
2 1 2
output:
Alice
result:
wrong answer 1st words differ - expected: 'Bob', found: 'Alice'