QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#666848 | #7786. Graft and Transplant | njupt_zy | WA | 1ms | 6024kb | C++17 | 726b | 2024-10-22 20:11:26 | 2024-10-22 20:11:33 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl "\n"
template<typename T>
void read(T &t){
t=0;int flag=1;char c=getchar();
while(c<'0'||c>'9'){if(c=='-')flag=-1;c=getchar();}
while(c>='0'&&c<='9'){t=(t<<3)+(t<<1)+c-'0';c=getchar();}
t=t*flag;
}
const int N=1e5+5;
vector<int> p[N];
int du[N];
int main(){
int n;cin>>n;
for(int i=1;i<n;i++){
int x,y;cin>>x>>y;
p[x].push_back(y);
p[y].push_back(x);
du[x]++;du[y]++;
}
if(n==2)cout<<"Bob"<<endl;
int ans=0;
for(int i=1;i<=n;i++){
if(du[i]!=1)ans++;
}
if(ans%2==0)cout<<"Alice"<<endl;
else cout<<"Bob"<<endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 6024kb
input:
4 1 2 2 3 3 4
output:
Alice
result:
ok "Alice"
Test #2:
score: 0
Accepted
time: 1ms
memory: 5880kb
input:
4 1 2 1 3 1 4
output:
Bob
result:
ok "Bob"
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 5944kb
input:
2 1 2
output:
Bob Alice
result:
wrong answer Participant output contains extra tokens