QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#666729 | #7786. Graft and Transplant | njupt_zy | WA | 1ms | 5992kb | C++17 | 675b | 2024-10-22 19:45:48 | 2024-10-22 19:45:52 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
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]++;
}
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: 5924kb
input:
4 1 2 2 3 3 4
output:
Alice
result:
ok "Alice"
Test #2:
score: 0
Accepted
time: 1ms
memory: 5992kb
input:
4 1 2 1 3 1 4
output:
Bob
result:
ok "Bob"
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 5920kb
input:
2 1 2
output:
Alice
result:
wrong answer 1st words differ - expected: 'Bob', found: 'Alice'