QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#633797 | #7786. Graft and Transplant | the_fool# | WA | 1ms | 3656kb | C++20 | 671b | 2024-10-12 16:12:48 | 2024-10-12 16:12:48 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ll = long long;
int num[55];
void solve() {
int n;
cin >> n;
for(int i=1;i<n;i++)
{
int u,v;
cin>>u>>v;
num[u]++;
num[v]++;
}
int cnt=0;
for(int i=1;i<=n;i++)
if(num[i]==1)cnt++;
if(cnt%2==0)cout<<"Alice"<<endl;
else cout<<"Bob"<<endl;
}
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
#ifdef Debug
assert(freopen("in.txt", "r", stdin));
assert(freopen("out.txt", "w", stdout));
#endif
int t = 1;
//cin >> t;
while (t--) {
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3656kb
input:
4 1 2 2 3 3 4
output:
Alice
result:
ok "Alice"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
4 1 2 1 3 1 4
output:
Bob
result:
ok "Bob"
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3588kb
input:
2 1 2
output:
Alice
result:
wrong answer 1st words differ - expected: 'Bob', found: 'Alice'