QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#744511#7786. Graft and TransplantCharlie983WA 0ms3776kbC++14761b2024-11-13 22:12:052024-11-13 22:12:14

Judging History

你现在查看的是最新测评结果

  • [2024-11-13 22:12:14]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3776kb
  • [2024-11-13 22:12:05]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define endl '\n'
const int N = 1e6 + 10,M=210;
const int inf=0x3f3f3f3f,mod=998244353;

void solve()
{
    int n;cin>>n;
    vector<int>e[n+1];
    for(int i=1;i<n;i++)
    {
        int u,v;cin>>u>>v;
        e[u].push_back(v);
        e[v].push_back(u);
    }
    int fg=0;
    for(int i=1;i<=n;i++)
    {
        if(e[i].size()==n-1)fg=1;
        else if(e[i].size()==n-2)fg=-1;
    }
    if(fg==1)cout<<"Bob"<<endl;
    else cout<<"Alice"<<endl;
    // else cout<<"Draw"<<endl;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int T=1;
    // cin>>T;
    while(T--)
    {
        solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3540kb

input:

4
1 2
2 3
3 4

output:

Alice

result:

ok "Alice"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3776kb

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3568kb

input:

2
1 2

output:

Bob

result:

ok "Bob"

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 3748kb

input:

3
1 2
1 3

output:

Alice

result:

wrong answer 1st words differ - expected: 'Bob', found: 'Alice'