QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#677736#7786. Graft and Transplantyumingsk#WA 0ms3616kbC++201.2kb2024-10-26 13:20:452024-10-26 13:20:45

Judging History

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

  • [2024-10-26 13:20:45]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3616kb
  • [2024-10-26 13:20:45]
  • 提交

answer

#pragma GCC optimize(3, "Ofast", "inline")
#include <iostream>
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define INF 0x3f3f3f3f
#define L_INF 0x7f3f3f3f3f3f3f3f
#define db cout << "debug\n";

using namespace std;
const int Mod = 998244353;
using ll = long long;

void solve()
{
    int n;
    cin >> n;
    vector<int> deg(n + 1, 0);
    for (int i = 1; i < n; i++)
    {
        int x, y;
        cin >> x >> y;
        // cout << x << ' ' << y << '\n';
        deg[y]++;
        deg[x]++;
    }
    int cnt = 0;
    for (int i = 1; i <= n; i++)
    {
        if (deg[i] != 1)
            cnt++;
        // cout << cnt << '\n';
    }
    // cout << cnt << '\n';
    if (cnt & 1)
    {
        cout << "Bob\n";
    }
    else
    {
        cout << "Alice\n";
    }
}
int main()
{
    IOS;
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
#ifndef ONLINE_JUDGE
    clock_t start_time = clock();
#endif
    int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
#ifndef ONLINE_JUDGE
    cout << "Used " << (double)(clock() - start_time) << " ms" << endl;
#endif
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
1 2
2 3
3 4

output:

Alice

result:

ok "Alice"

Test #2:

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

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

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

input:

2
1 2

output:

Alice

result:

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