QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#510933 | #7786. Graft and Transplant | ideograph_advantage# | WA | 0ms | 3588kb | C++17 | 1012b | 2024-08-09 14:19:00 | 2024-08-09 14:19:01 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define iter(v) v.begin(), v.end()
#define SZ(v) int(v.size())
#define pb emplace_back
#define ff first
#define ss second
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#ifdef zisk
void debug(){cerr << "\n";}
template<class T, class ... U>
void debug(T a, U ... b){cerr << a << " ", debug(b...);}
template<class T> void pary(T l, T r){
while (l != r) cerr << *l << " ", l++;
cerr << "\n";
}
#else
#define debug(...) void()
#define pary(...) void()
#endif
template<class A, class B>
ostream &operator<<(ostream& o, pair<A, B> p) {
return o << '(' << p.ff << ',' << p.ss << ')';
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int> deg(n);
for(int i=1;i<n;i++){
int a,b;
cin >> a >> b;
a--;
b--;
deg[a]++;
deg[b]++;
}
int cnt=0;
for(int i=0;i<n;i++){
if(deg[i]==1){
cnt++;
}
}
int r=n-1;
if((r-cnt)%2==0){
cout << "Bob\n";
}
else{
cout << "Alice\n";
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3536kb
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: 3588kb
input:
2 1 2
output:
Alice
result:
wrong answer 1st words differ - expected: 'Bob', found: 'Alice'