QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#633797#7786. Graft and Transplantthe_fool#WA 1ms3656kbC++20671b2024-10-12 16:12:482024-10-12 16:12:48

Judging History

This is the latest submission verdict.

  • [2024-10-12 16:12:48]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3656kb
  • [2024-10-12 16:12:48]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;

using LL = long long;
using ll = long long;
int num[55];
void solve() {
    int n;
    cin >> n;
    for(int i=1;i<n;i++)
    {
        int u,v;
        cin>>u>>v;
        num[u]++;
        num[v]++;
    }
    int cnt=0;
    for(int i=1;i<=n;i++)
        if(num[i]==1)cnt++;
    if(cnt%2==0)cout<<"Alice"<<endl;
    else cout<<"Bob"<<endl;
}

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

#ifdef Debug
    assert(freopen("in.txt", "r", stdin));
    assert(freopen("out.txt", "w", stdout));
#endif

    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3656kb

input:

4
1 2
2 3
3 4

output:

Alice

result:

ok "Alice"

Test #2:

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

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

score: -100
Wrong Answer
time: 1ms
memory: 3588kb

input:

2
1 2

output:

Alice

result:

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