Submission #1613479
Source Code Expand
#include<cstdio> #include<cstdlib> #include<cstring> #include<algorithm> using namespace std; const int MX=100011; int n; struct Edge{int t,nxt;Edge(int _t=0,int _nxt=0):t(_t),nxt(_nxt){}}e[MX<<1]; int hed[MX],ec; inline void ade(int f,int t){e[++ec]=Edge(t,hed[f]);hed[f]=ec;} #define FE(k,i) for(int (i)=hed[k];(i);(i)=e[i].nxt)if(e[i].t!=f) int SG(int k,int f){ int sum=0; FE(k,i)sum^=SG(e[i].t,k)+1; return sum; } int main(){ scanf("%d",&n); for(int i=1;i<n;i++){ static int a,b;scanf("%d%d",&a,&b); ade(a,b),ade(b,a); } puts(SG(1,0)?"Alice":"Bob"); return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Game on Tree |
User | CommonAnts |
Language | C++14 (GCC 5.4.1) |
Score | 1100 |
Code Size | 605 Byte |
Status | AC |
Exec Time | 25 ms |
Memory | 6784 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:19:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&n); ^ ./Main.cpp:21:37: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] static int a,b;scanf("%d%d",&a,&b); ^
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 | 1 ms | 1792 KB |
a10.txt | AC | 3 ms | 1920 KB |
a11.txt | AC | 3 ms | 1920 KB |
a12.txt | AC | 3 ms | 1920 KB |
a13.txt | AC | 21 ms | 2176 KB |
a14.txt | AC | 21 ms | 2176 KB |
a15.txt | AC | 16 ms | 2048 KB |
a16.txt | AC | 21 ms | 2304 KB |
a17.txt | AC | 21 ms | 2304 KB |
a18.txt | AC | 21 ms | 2304 KB |
a19.txt | AC | 21 ms | 3200 KB |
a2.txt | AC | 2 ms | 1792 KB |
a20.txt | AC | 22 ms | 3328 KB |
a21.txt | AC | 18 ms | 2944 KB |
a22.txt | AC | 20 ms | 2176 KB |
a23.txt | AC | 21 ms | 2176 KB |
a24.txt | AC | 16 ms | 2048 KB |
a25.txt | AC | 21 ms | 2304 KB |
a26.txt | AC | 21 ms | 2304 KB |
a27.txt | AC | 21 ms | 2304 KB |
a28.txt | AC | 21 ms | 3200 KB |
a29.txt | AC | 22 ms | 3328 KB |
a3.txt | AC | 2 ms | 1792 KB |
a30.txt | AC | 18 ms | 2944 KB |
a4.txt | AC | 3 ms | 1792 KB |
a5.txt | AC | 3 ms | 1792 KB |
a6.txt | AC | 3 ms | 1792 KB |
a7.txt | AC | 3 ms | 1792 KB |
a8.txt | AC | 3 ms | 1792 KB |
a9.txt | AC | 3 ms | 1792 KB |
b1.txt | AC | 25 ms | 6784 KB |
b2.txt | AC | 23 ms | 4480 KB |
b3.txt | AC | 25 ms | 6784 KB |
b4.txt | AC | 23 ms | 4480 KB |
b5.txt | AC | 23 ms | 4480 KB |
sample1.txt | AC | 1 ms | 1664 KB |
sample2.txt | AC | 1 ms | 1664 KB |
sample3.txt | AC | 1 ms | 1664 KB |
sample4.txt | AC | 1 ms | 1792 KB |