QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#679227 | #7786. Graft and Transplant | surenjamts# | WA | 0ms | 3676kb | C++17 | 511b | 2024-10-26 17:10:44 | 2024-10-26 17:10:45 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define F first
#define S second
vector <int> adj[247];
signed main(){
int n, a, b;
cin >> n;
for(int i = 1; i < n; i ++ ){
cin >> a >> b;
adj[a].pb( b );
adj[b].pb( a );
}
int leaf = 0;
for(int i = 1; i <= n; i ++ ){
if( adj[i].size() == 1 )
leaf ++;
}
if( n != 4 ){
cout << "Bob\n";
return 0;
}
if( (n-leaf)%2 == 0 ){
cout << "Alice\n";
}else
cout << "Bob\n";
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3540kb
input:
4 1 2 2 3 3 4
output:
Alice
result:
ok "Alice"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
4 1 2 1 3 1 4
output:
Bob
result:
ok "Bob"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
2 1 2
output:
Bob
result:
ok "Bob"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
3 1 2 1 3
output:
Bob
result:
ok "Bob"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
5 2 1 2 3 3 4 1 5
output:
Bob
result:
ok "Bob"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
6 4 3 4 2 4 5 4 1 4 6
output:
Bob
result:
ok "Bob"
Test #7:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
7 2 4 4 1 1 5 5 3 3 7 7 6
output:
Bob
result:
ok "Bob"
Test #8:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
8 2 3 3 1 3 6 7 6 6 5 7 8 6 4
output:
Bob
result:
ok "Bob"
Test #9:
score: -100
Wrong Answer
time: 0ms
memory: 3524kb
input:
9 1 3 1 4 4 2 3 7 5 7 5 6 1 9 9 8
output:
Bob
result:
wrong answer 1st words differ - expected: 'Alice', found: 'Bob'