QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#376666 | #7786. Graft and Transplant | zhouyidie | WA | 0ms | 3712kb | C++17 | 646b | 2024-04-04 14:52:29 | 2024-04-04 14:52:30 |
Judging History
answer
#include<bits/stdc++.h>
typedef long long LL ;
using namespace std;
const int N = 1e6 + 5 ;
LL n;
int e[N];
void AC(){
cin >> n;
for(int i = 1; i < n; ++i) {
int u, v;
cin >> v >> u ;
e[ v ] ++ ;
e[ u ] ++ ;
}
int cnt = 0 ;
for(int i = 1; i <= n ; i++ ){
if( e[ i ] != 1 ){
cnt++ ;
}
}
if( cnt & 1 ){
cout << "Bob\n";
}else{
cout << "Alice" ;
}
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int t = 1;
//cin >> t;
while(t --){
AC();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3688kb
input:
4 1 2 2 3 3 4
output:
Alice
result:
ok "Alice"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
4 1 2 1 3 1 4
output:
Bob
result:
ok "Bob"
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3712kb
input:
2 1 2
output:
Alice
result:
wrong answer 1st words differ - expected: 'Bob', found: 'Alice'