QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#764519 | #7786. Graft and Transplant | fosov | WA | 0ms | 3652kb | C++14 | 744b | 2024-11-20 09:34:03 | 2024-11-20 09:34:06 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define lll __int128
#define INF 0x3f3f3f3f
#define LNF 0x3f3f3f3f3f3f3f3fll
#define MOD 998244353
#define pii pair<int, int>
#define ld long double
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define N 110
int deg[N];
int main() {
#ifdef TEST
freopen("zz.in", "r+", stdin);
#endif
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n; cin >> n;
for (int i = 1; i < n; ++ i) {
int u, v; cin >> u >> v;
deg[u] ++, deg[v] ++;
}
int k = -1;
for (int i = 1; i <= n; ++ i) k += deg[i] != 1;
cout << (k%2?"Alice":"Bob") << '\n';
}
// 3 3
// 2 2
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3596kb
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: 0ms
memory: 3652kb
input:
2 1 2
output:
Alice
result:
wrong answer 1st words differ - expected: 'Bob', found: 'Alice'