Submission #1442991
Source Code Expand
#ifndef KHOKHO //#pragma GCC optimize("O3") #endif #include<bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> // Common file //#include <ext/pb_ds/tree_policy.hpp> using namespace std; //using namespace __gnu_pbds; //#define CHKR #define ll long long #define pb push_back #define mp make_pair #define fr first #define sc second #define ARRS int(1e6+500) #define MAX ((long long)(1e18+1)) #define EP ((double)(1e-12)) #define HS1 ((ll)(1000001329)) #define HS2 ((ll)(1000001531)) #define MOD ((long long)1000000007ll) #define AT9 ((long long)1000000000ll) #define PI 3.14159265358979323846264338327950288419716939937510 #define LG 20 vector<ll> v[ARRS]; ll dp[ARRS]; void go(ll x,ll p){ set<ll> st; ll xr=0; for(auto y:v[x]){ if(y==p)continue; go(y,x); xr^=(dp[y]+1); } dp[x]=xr; //cout<<x<<" "<<dp[x]<<endl; } int main(){ #ifdef KHOKHO freopen("in.in","r",stdin); freopen("out.out","w+",stdout); #endif //KHOKHO ll n,a,k,p,b,c,d; cin>>n; for(int i=0; i<n-1; i++){ cin>>k>>p; v[k].pb(p); v[p].pb(k); } go(1,-1); if(dp[1]){ cout<<"Alice"; } else cout<<"Bob"; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Game on Tree |
User | khokho |
Language | C++14 (GCC 5.4.1) |
Score | 1100 |
Code Size | 1187 Byte |
Status | AC |
Exec Time | 89 ms |
Memory | 40192 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 1100 / 1100 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample1.txt, sample2.txt, sample3.txt, sample4.txt |
All | sample1.txt, sample2.txt, sample3.txt, sample4.txt, a1.txt, a10.txt, a11.txt, a12.txt, a13.txt, a14.txt, a15.txt, a16.txt, a17.txt, a18.txt, a19.txt, a2.txt, a20.txt, a21.txt, a22.txt, a23.txt, a24.txt, a25.txt, a26.txt, a27.txt, a28.txt, a29.txt, a3.txt, a30.txt, a4.txt, a5.txt, a6.txt, a7.txt, a8.txt, a9.txt, b1.txt, b2.txt, b3.txt, b4.txt, b5.txt, sample1.txt, sample2.txt, sample3.txt, sample4.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
a1.txt | AC | 9 ms | 25472 KB |
a10.txt | AC | 15 ms | 26112 KB |
a11.txt | AC | 15 ms | 26112 KB |
a12.txt | AC | 15 ms | 26112 KB |
a13.txt | AC | 83 ms | 29952 KB |
a14.txt | AC | 82 ms | 29952 KB |
a15.txt | AC | 67 ms | 29056 KB |
a16.txt | AC | 83 ms | 30464 KB |
a17.txt | AC | 83 ms | 30464 KB |
a18.txt | AC | 84 ms | 30464 KB |
a19.txt | AC | 82 ms | 32128 KB |
a2.txt | AC | 10 ms | 25472 KB |
a20.txt | AC | 84 ms | 32512 KB |
a21.txt | AC | 69 ms | 31104 KB |
a22.txt | AC | 82 ms | 29952 KB |
a23.txt | AC | 85 ms | 29952 KB |
a24.txt | AC | 67 ms | 29056 KB |
a25.txt | AC | 83 ms | 30464 KB |
a26.txt | AC | 82 ms | 30464 KB |
a27.txt | AC | 83 ms | 30464 KB |
a28.txt | AC | 82 ms | 32128 KB |
a29.txt | AC | 84 ms | 32512 KB |
a3.txt | AC | 12 ms | 25600 KB |
a30.txt | AC | 70 ms | 31104 KB |
a4.txt | AC | 15 ms | 25856 KB |
a5.txt | AC | 15 ms | 25856 KB |
a6.txt | AC | 16 ms | 25856 KB |
a7.txt | AC | 16 ms | 25856 KB |
a8.txt | AC | 15 ms | 25856 KB |
a9.txt | AC | 15 ms | 25856 KB |
b1.txt | AC | 88 ms | 40192 KB |
b2.txt | AC | 88 ms | 34688 KB |
b3.txt | AC | 89 ms | 40192 KB |
b4.txt | AC | 85 ms | 34688 KB |
b5.txt | AC | 86 ms | 34688 KB |
sample1.txt | AC | 8 ms | 25344 KB |
sample2.txt | AC | 8 ms | 25344 KB |
sample3.txt | AC | 8 ms | 25344 KB |
sample4.txt | AC | 8 ms | 25344 KB |