QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#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();
}
}
详细
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'