Submission #3449119
Source Code Expand
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#define LL long long
#define M 200020
using namespace std;
namespace IO{
const int BS=(1<<20); int Top=0;
char Buffer[BS],OT[BS],*OS=OT,*HD,*TL,SS[20]; const char *fin=OT+BS-1;
char Getchar(){if(HD==TL){TL=(HD=Buffer)+fread(Buffer,1,BS,stdin);} return (HD==TL)?EOF:*HD++;}
void flush(){fwrite(OT,1,OS-OT,stdout);}
void Putchar(char c){*OS++ =c;if(OS==fin)flush(),OS=OT;}
void write(int x){
if(!x){Putchar('0');return;} if(x<0) x=-x,Putchar('-');
while(x) SS[++Top]=x%10,x/=10;
while(Top) Putchar(SS[Top]+'0'),--Top;
}
int read(){
int nm=0,fh=1; char cw=Getchar();
for(;!isdigit(cw);cw=Getchar()) if(cw=='-') fh=-fh;
for(;isdigit(cw);cw=Getchar()) nm=nm*10+(cw-'0');
return nm*fh;
}
}
using namespace IO;
int n,fs[M],nt[M],to[M],tmp;
void link(int x,int y){nt[tmp]=fs[x],fs[x]=tmp,to[tmp++]=y;}
int DP(int x,int last){
int sg=0;
for(int i=fs[x];i!=-1;i=nt[i]) if(to[i]!=last) sg^=(DP(to[i],x)+1);
return sg;
}
int main(){
// freopen("a.in","r",stdin);
// freopen("a.out","w",stdout);
n=read(),memset(fs,-1,sizeof(fs));
for(int i=1;i<n;i++){int x=read(),y=read();link(x,y),link(y,x);}
puts(DP(1,0)?"Alice":"Bob");
return 0;
}
Submission Info
Submission Time |
|
Task |
A - Biscuits |
User |
OYJason |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1284 Byte |
Status |
WA |
Exec Time |
2103 ms |
Memory |
2816 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 200 |
Status |
|
|
Set Name |
Test Cases |
Sample |
sample1.txt, sample2.txt, sample3.txt, sample4.txt |
All |
sample1.txt, sample2.txt, sample3.txt, sample4.txt, in1.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, sample1.txt, sample2.txt, sample3.txt, sample4.txt |
Case Name |
Status |
Exec Time |
Memory |
in1.txt |
TLE |
2103 ms |
2816 KB |
in2.txt |
TLE |
2103 ms |
2816 KB |
in3.txt |
TLE |
2103 ms |
2816 KB |
in4.txt |
TLE |
2103 ms |
2816 KB |
in5.txt |
TLE |
2103 ms |
2816 KB |
in6.txt |
TLE |
2103 ms |
2816 KB |
in7.txt |
TLE |
2103 ms |
2816 KB |
in8.txt |
TLE |
2103 ms |
2816 KB |
sample1.txt |
WA |
2 ms |
2816 KB |
sample2.txt |
WA |
1 ms |
2816 KB |
sample3.txt |
WA |
1 ms |
2816 KB |
sample4.txt |
TLE |
2103 ms |
2816 KB |