QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#707089 | #7786. Graft and Transplant | SDNUyuqi | WA | 0ms | 3692kb | C++23 | 757b | 2024-11-03 14:38:58 | 2024-11-03 14:39:07 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long ll;
const int N=100;
vector<int>nx[N];
int si[N];
int an; int n;
void dfs(int be,int ne)
{
si[ne]=1;
for(auto i:nx[ne])
{
if(i==be)
{
continue;
}
dfs(ne,i);
si[ne]+=si[i];
if(si[i]>1&&n-si[i]>1)
{
an++;
}
}
}
int main()
{
cin>>n;
for(int i=2;i<=n;i++)
{
int u,v;
cin>>u>>v;
nx[u].push_back(v);
nx[v].push_back(u);
}
dfs(0,1);
if(an)
{
cout<<"Alice\n";
}
else{
cout<<"Bob\n";
}
//system("pause");
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3596kb
input:
4 1 2 2 3 3 4
output:
Alice
result:
ok "Alice"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
4 1 2 1 3 1 4
output:
Bob
result:
ok "Bob"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
2 1 2
output:
Bob
result:
ok "Bob"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
3 1 2 1 3
output:
Bob
result:
ok "Bob"
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 3608kb
input:
5 2 1 2 3 3 4 1 5
output:
Alice
result:
wrong answer 1st words differ - expected: 'Bob', found: 'Alice'