Submission #1776201
Source Code Expand
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
#define SZ 666666
int n,sg[SZ]; Edg
inline void dfs(int x,int f=0)
{for esb(x,e,b) if(b!=f) dfs(b,x),sg[x]^=sg[b]+1;}
int main()
{
scanf("%d",&n);
for(int i=1,a,b;i<n;++i)
scanf("%d%d",&a,&b),adde(a,b);
dfs(1);
if(sg[1]) puts("Alice");
else puts("Bob");
}
Submission Info
Submission Time
2017-11-16 10:50:29+0900
Task
D - Game on Tree
User
fjzzq2002
Language
C++14 (GCC 5.4.1)
Score
1100
Code Size
1312 Byte
Status
AC
Exec Time
27 ms
Memory
11648 KB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:38:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&n);
^
./Main.cpp:40:32: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d",&a,&b),adde(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
3 ms
6400 KB
a10.txt
AC
5 ms
6528 KB
a11.txt
AC
5 ms
6528 KB
a12.txt
AC
5 ms
6528 KB
a13.txt
AC
24 ms
9216 KB
a14.txt
AC
24 ms
9216 KB
a15.txt
AC
19 ms
7040 KB
a16.txt
AC
24 ms
9344 KB
a17.txt
AC
24 ms
9344 KB
a18.txt
AC
25 ms
9344 KB
a19.txt
AC
24 ms
9728 KB
a2.txt
AC
3 ms
6400 KB
a20.txt
AC
25 ms
9856 KB
a21.txt
AC
20 ms
7552 KB
a22.txt
AC
24 ms
9216 KB
a23.txt
AC
24 ms
9216 KB
a24.txt
AC
19 ms
7040 KB
a25.txt
AC
24 ms
9344 KB
a26.txt
AC
24 ms
9344 KB
a27.txt
AC
24 ms
9344 KB
a28.txt
AC
24 ms
9728 KB
a29.txt
AC
25 ms
9856 KB
a3.txt
AC
4 ms
6400 KB
a30.txt
AC
20 ms
7552 KB
a4.txt
AC
5 ms
6528 KB
a5.txt
AC
5 ms
6528 KB
a6.txt
AC
5 ms
6528 KB
a7.txt
AC
5 ms
6528 KB
a8.txt
AC
5 ms
6528 KB
a9.txt
AC
5 ms
6528 KB
b1.txt
AC
27 ms
11648 KB
b2.txt
AC
26 ms
10496 KB
b3.txt
AC
26 ms
11648 KB
b4.txt
AC
26 ms
10496 KB
b5.txt
AC
26 ms
10368 KB
sample1.txt
AC
3 ms
6400 KB
sample2.txt
AC
3 ms
6400 KB
sample3.txt
AC
3 ms
6400 KB
sample4.txt
AC
3 ms
6400 KB