Submission #1774064


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define re(i,a,b) for(int i=(a);i<(b);i++)
#define repd(i,a,b) for(int i=(a);i>=(b);i--)
#define run(a) for(int k=head[a];k;k=e[k].ne)
#define clr(a) memset(a,0,sizeof(a));
#define il inline
#define sz(a) ((int)a.size())
#define all(a) a.begin(),a.end()
#define mp make_pair
#define pb push_back 
#define w1 first
#define w2 second
#define adm(a,b,c) {a=a+b;if(a>=c)a-=c;else if(a<0)a+=c;}
typedef double db;
typedef long long ll;typedef long double ld;typedef unsigned long long ull;
typedef pair<ll,ll> pa;
const int N=1e6+5,M=5e3+5,INF=1e9,mod=998244353;
const ll linf=1e18;const double eps=1e-8,pi=acos(-1);
il int gmin(int &a,int b){if(a>b)a=b;}il ll gmin(ll &a,ll b){if(a>b)a=b;}il int gmax(int &a,int b){if(a<b)a=b;}il ll gmax(ll &a,ll b){if(a<b)a=b;}
il void read(ll&x){ll f=1,t=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){t=t*10+ch-'0';ch=getchar();}x=t*f;}il ll read(ll&x,ll&y){read(x);read(y);}
il void read(int&x){int f=1,t=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){t=t*10+ch-'0';ch=getchar();}x=t*f;}il int read(int&x,int&y){read(x);read(y);}
il void read(int&a,int&b,int&c){read(a);read(b);read(c);}il void read(ll&a,ll&b,ll&c){read(a);read(b);read(c);}
il int read(){int x;read(x);return x;}
il ll qpow(ll a,ll b,ll p){ll ret=1;for(;b;b>>=1,a=a*a%p)if(b&1)ret=ret*a%p;return ret;}il ll qpow(ll a,ll b){ll ret=1;for(;b;b>>=1,a=a*a%mod)if(b&1)ret=ret*a%mod;return ret;}
il ll qmul(ll a,ll b,ll p){ll ret=0;for(;b;b>>=1,a=(a<<1)%p)if(b&1)adm(ret,a,p);return ret;}il ll qmul(ll a,ll b){ll ret=0;for(;b;b>>=1,a=(a<<1)%mod)if(b&1)adm(ret,a,mod);return ret;}
il void judge(){
	freopen("data.in","r",stdin);
	freopen("data.out","w",stdout);}
int n;
vector<int>e[N];
int dfs(int x,int f){
	int res=0;
	re(i,0,e[x].size())if(e[x][i]!=f)res^=dfs(e[x][i],x)+1;
	return res;
}
int main(){
	read(n);re(i,1,n){
		int x,y;read(x,y);
		e[x].pb(y);e[y].pb(x);
	}
	cout<<(dfs(1,0)?"Alice":"Bob");
}

Submission Info

Submission Time
Task D - Game on Tree
User xjt
Language C++14 (GCC 5.4.1)
Score 1100
Code Size 2133 Byte
Status AC
Exec Time 48 ms
Memory 33152 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 1100 / 1100
Status
AC × 4
AC × 43
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 11 ms 23680 KB
a10.txt AC 14 ms 24192 KB
a11.txt AC 14 ms 24192 KB
a12.txt AC 14 ms 24192 KB
a13.txt AC 42 ms 27008 KB
a14.txt AC 41 ms 27008 KB
a15.txt AC 34 ms 26240 KB
a16.txt AC 41 ms 27264 KB
a17.txt AC 42 ms 27264 KB
a18.txt AC 41 ms 27264 KB
a19.txt AC 41 ms 28160 KB
a2.txt AC 12 ms 23808 KB
a20.txt AC 43 ms 28416 KB
a21.txt AC 39 ms 27520 KB
a22.txt AC 42 ms 26880 KB
a23.txt AC 41 ms 26880 KB
a24.txt AC 35 ms 26240 KB
a25.txt AC 42 ms 27264 KB
a26.txt AC 41 ms 27264 KB
a27.txt AC 41 ms 27264 KB
a28.txt AC 41 ms 28160 KB
a29.txt AC 43 ms 28416 KB
a3.txt AC 12 ms 23808 KB
a30.txt AC 36 ms 27520 KB
a4.txt AC 13 ms 24064 KB
a5.txt AC 14 ms 24064 KB
a6.txt AC 14 ms 24064 KB
a7.txt AC 14 ms 24064 KB
a8.txt AC 14 ms 24064 KB
a9.txt AC 14 ms 24064 KB
b1.txt AC 47 ms 33152 KB
b2.txt AC 45 ms 29952 KB
b3.txt AC 48 ms 33024 KB
b4.txt AC 45 ms 29952 KB
b5.txt AC 45 ms 29952 KB
sample1.txt AC 11 ms 23680 KB
sample2.txt AC 11 ms 23680 KB
sample3.txt AC 11 ms 23680 KB
sample4.txt AC 11 ms 23680 KB