QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#593912#7786. Graft and TransplantargtargWA 0ms3852kbC++20624b2024-09-27 16:55:282024-09-27 16:55:28

Judging History

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

  • [2024-09-27 16:55:28]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3852kb
  • [2024-09-27 16:55:28]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define pii pair<int, int>
void solve();

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1;
    // cin >> T;
    while (T--)solve();
    return 0;
}
const int mod = 1e9 + 7;


void solve() {
    int n;
    cin>>n;
    vector<int>a(n+1);
    for(int i=1;i<n;i++) {
        int x,y;
        cin>>x>>y;
        a[x]++;
        a[y]++;
    }
    int ans=0;
    for(int i=1;i<=n;i++) {
        ans+=(a[i]>=2);
    }
    if(ans&1^1)cout<<"Alice\n";
    else cout<<"Bob\n";
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
1 2
2 3
3 4

output:

Alice

result:

ok "Alice"

Test #2:

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

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

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

input:

2
1 2

output:

Alice

result:

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