QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#279882 | #7786. Graft and Transplant | ucup-team1631# | WA | 1ms | 3544kb | C++23 | 835b | 2023-12-09 11:11:15 | 2023-12-09 11:11:15 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, t) for (int i = (int)(s); i < (int)(t); ++i)
#define revrep(i, t, s) for (int i = (int)(t)-1; i >= (int)(s); --i)
#define all(x) begin(x), end(x)
template <typename T>
bool chmax(T& a, const T& b) {
return a < b ? (a = b, 1) : 0;
}
template <typename T>
bool chmin(T& a, const T& b) {
return a > b ? (a = b, 1) : 0;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout << fixed << setprecision(15);
int n;
cin >> n;
vector<int> deg(n);
rep(_, 0, n - 1) {
int u, v;
cin >> u >> v;
--u, --v;
++deg[u], ++deg[v];
}
int cnt = 0;
rep(i, 0, n) if (deg[i] > 1)++ cnt;
cout << (cnt % 2 == 0 ? "Alice" : "Bob") << endl;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3432kb
input:
4 1 2 2 3 3 4
output:
Alice
result:
ok "Alice"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
4 1 2 1 3 1 4
output:
Bob
result:
ok "Bob"
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3480kb
input:
2 1 2
output:
Alice
result:
wrong answer 1st words differ - expected: 'Bob', found: 'Alice'