QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#281187 | #7786. Graft and Transplant | ucup-team139# | WA | 0ms | 3440kb | C++23 | 558b | 2023-12-09 22:58:42 | 2023-12-09 22:58:42 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
void solve(int t){
int n;
cin>>n;
vector deg(n+1,0);
for(int i=0;i<n-1;i++){
int u,v;
cin>>u>>v;
deg[u]++;
deg[v]++;
}
int cont=0;
for(int i=1;i<=n;i++){
if(deg[i]>1)cont++;
}
cont--;
cout<<(cont%2==0 ? "Bob" : "Alice")<<"\n";
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int t=1;
//cin>>t;
for(int i=1;i<=t;i++)solve(i);
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3432kb
input:
4 1 2 2 3 3 4
output:
Alice
result:
ok "Alice"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3440kb
input:
4 1 2 1 3 1 4
output:
Bob
result:
ok "Bob"
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3432kb
input:
2 1 2
output:
Alice
result:
wrong answer 1st words differ - expected: 'Bob', found: 'Alice'