QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#777826 | #7781. Sheep Eat Wolves | 4eyebird# | RE | 0ms | 0kb | C++17 | 921b | 2024-11-24 10:06:05 | 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;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Runtime Error
input:
4 4 3 1