QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#777826#7781. Sheep Eat Wolves4eyebird#RE 0ms0kbC++17921b2024-11-24 10:06:052024-11-24 10:06:05

Judging History

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

  • [2024-11-24 10:06:05]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-11-24 10:06:05]
  • 提交

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] ++;
    }
    if (n == 2)
    {
        cout << "Bob";
        return;
    }

    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;
}

詳細信息

Test #1:

score: 0
Runtime Error

input:

4 4 3 1

output:


result: