QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#777821#7786. Graft and Transplant4eyebird#WA 1ms3828kbC++17847b2024-11-24 10:03:042024-11-24 10:03:08

Judging History

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

  • [2024-11-24 10:03:08]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3828kb
  • [2024-11-24 10:03:04]
  • 提交

answer

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

#define Buff ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
//#define int long long


void solve()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0,u ,v;i < n - 1;i ++)
    {
        cin >> u >> v;
        u --;
        v --;
        a[u] ++;
        a[v] ++;
    }
    int s = n - 1;
    for (int i = 0;i < n;i ++)
    {
        if (a[i] == 1)
        {
            s --;
        }
    }
    if (s & 1)
    {
        cout << "Alice";
    }
    else
    {
        cout << "Bob";
    }

}

signed main()
{
#ifdef YGYYYGJ
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    Buff;
    int _T_ = 1;
    while (_T_--)
    {
        solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
1 2
2 3
3 4

output:

Alice

result:

ok "Alice"

Test #2:

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

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

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

input:

2
1 2

output:

Alice

result:

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