QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#302809 | #7786. Graft and Transplant | ucup-team173# | WA | 1ms | 3552kb | C++17 | 715b | 2024-01-11 13:29:17 | 2024-01-11 13:29:17 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define Mp make_pair
#define SZ(x) (int((x).size()))
typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef pair<int, int> pii;
void solve() {
int n;
cin >> n;
vi d(n + 1);
for(int i = 1; i < n; i++) {
int u, v;
cin >> u >> v;
d[u]++, d[v]++;
}
int cnt = n - 1;
for(int i = 1; i <= n; i++) if(d[i] == 1) cnt--;
cout << (cnt % 2 ? "Alice" : "Bob") << '\n';
}
signed main() {
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
int t = 1;
// cin >> t;
while(t--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3536kb
input:
4 1 2 2 3 3 4
output:
Alice
result:
ok "Alice"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
4 1 2 1 3 1 4
output:
Bob
result:
ok "Bob"
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3544kb
input:
2 1 2
output:
Alice
result:
wrong answer 1st words differ - expected: 'Bob', found: 'Alice'