QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#744363 | #7786. Graft and Transplant | yld# | WA | 0ms | 3748kb | C++20 | 534b | 2024-11-13 21:39:47 | 2024-11-13 21:39:48 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;
void solve()
{
int n;
cin>>n;
vector<int> deg(n+1);
for(int i=1;i<n;i++)
{
int u,v;
cin>>u>>v;
deg[v]++;
deg[u]++;
}
int flag=0;
for(int i=1;i<=n;i++)
{
if(deg[i]==n-1) flag=1;
}
if(flag) cout<<"Bob\n";
else cout<<"Alice\n";
}
signed main()
{
cin.tie(0)->sync_with_stdio(0);
int t=1;
while(t--) solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3748kb
input:
4 1 2 2 3 3 4
output:
Alice
result:
ok "Alice"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
4 1 2 1 3 1 4
output:
Bob
result:
ok "Bob"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
2 1 2
output:
Bob
result:
ok "Bob"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
3 1 2 1 3
output:
Bob
result:
ok "Bob"
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 3592kb
input:
5 2 1 2 3 3 4 1 5
output:
Alice
result:
wrong answer 1st words differ - expected: 'Bob', found: 'Alice'