Submission #3449191


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
namespace IO
{
    const int __S=(1<<20)+5;char __buf[__S],*__H,*__T;
    inline char getc()
    {
        if(__H==__T) __T=(__H=__buf)+fread(__buf,1,__S,stdin);
        if(__H==__T) return -1;return *__H++;
    }
    template <class __I>inline void read(__I &__x)
    {
        __x=0;int __fg=1;char __c=getc();
        while(!isdigit(__c)&&__c!='-') __c=getc();
        if(__c=='-') __fg=-1,__c=getc();
        while(isdigit(__c)) __x=__x*10+__c-'0',__c=getc();
        __x*=__fg;
    }
    inline void readd(double &__x)
    {
        __x=0;double __fg=1.0;char __c=getc();
        while(!isdigit(__c)&&__c!='-') __c=getc();
        if(__c=='-') __fg=-1.0,__c=getc();
        while(isdigit(__c)) __x=__x*10.0+__c-'0',__c=getc();
        if(__c!='.'){__x=__x*__fg;return;}else while(!isdigit(__c)) __c=getc();
        double __t=1e-1;while(isdigit(__c)) __x=__x+1.0*(__c-'0')*__t,__t=__t*0.1,__c=getc();
        __x=__x*__fg;
    }
    inline void reads(char *__s,int __x)
    {
        char __c=getc();int __tot=__x-1;
        while(__c<'!'||__c>'~') __c=getc();
        while(__c>='!'&&__c<='~') __s[++__tot]=__c,__c=getc();
        __s[++__tot]='\0';
    }
    char __obuf[__S],*__oS=__obuf,*__oT=__oS+__S-1,__c,__qu[55];int __qr;
    inline void flush(){fwrite(__obuf,1,__oS-__obuf,stdout);__oS=__obuf;}
    inline void putc(char __x){*__oS++ =__x;if(__oS==__oT) flush();}
    template <class __I>inline void print(__I __x)
    {
        if(!__x) putc('0');
        if(__x<0) putc('-'),__x=-__x;
        while(__x) __qu[++__qr]=__x%10+'0',__x/=10;
        while(__qr) putc(__qu[__qr--]);
    }
    inline void prints(const char *__s,const int __x)
    {
        int __len=strlen(__s+__x);
        for(int __i=__x;__i<__len+__x;__i++) putc(__s[__i]);
    }
    inline void printd(double __x,int __d)
    {
        long long __t=(long long)floor(__x);print(__t);putc('.');__x-=(double)__t;
        while(__d--)
        {
            double __y=__x*10.0;__x*=10.0;
            int __c=(int)floor(__y);
            putc(__c+'0');__x-=floor(__y);
        }
    }
    inline void el(){putc('\n');}inline void sp(){putc(' ');}
}using namespace IO;
int n,x,y,sg[100005];vector<int>e[100005];void add(int x,int y){e[x].push_back(y);e[y].push_back(x);}
void dfs(int x,int fa){for(int i=0;i<e[x].size();i++) if(e[x][i]!=fa) dfs(e[x][i],x),sg[x]^=(sg[e[x][i]]+1);}
int main(){read(n);for(int i=1;i<n;i++) read(x),read(y),add(x,y);dfs(1,0);puts(sg[1]?"Alice":"Bob");}

Submission Info

Submission Time
Task D - Game on Tree
User WG6101N
Language C++14 (GCC 5.4.1)
Score 1100
Code Size 2570 Byte
Status AC
Exec Time 28 ms
Memory 14336 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 3 ms 4352 KB
a10.txt AC 4 ms 4736 KB
a11.txt AC 4 ms 4736 KB
a12.txt AC 4 ms 4736 KB
a13.txt AC 23 ms 8320 KB
a14.txt AC 23 ms 8320 KB
a15.txt AC 19 ms 7552 KB
a16.txt AC 23 ms 8576 KB
a17.txt AC 24 ms 8576 KB
a18.txt AC 24 ms 8576 KB
a19.txt AC 24 ms 9472 KB
a2.txt AC 3 ms 4352 KB
a20.txt AC 25 ms 9728 KB
a21.txt AC 21 ms 8704 KB
a22.txt AC 23 ms 8320 KB
a23.txt AC 23 ms 8320 KB
a24.txt AC 19 ms 7552 KB
a25.txt AC 23 ms 8576 KB
a26.txt AC 24 ms 8576 KB
a27.txt AC 23 ms 8576 KB
a28.txt AC 24 ms 9472 KB
a29.txt AC 25 ms 9728 KB
a3.txt AC 3 ms 4480 KB
a30.txt AC 21 ms 8704 KB
a4.txt AC 4 ms 4608 KB
a5.txt AC 4 ms 4608 KB
a6.txt AC 4 ms 4608 KB
a7.txt AC 4 ms 4736 KB
a8.txt AC 4 ms 4736 KB
a9.txt AC 4 ms 4736 KB
b1.txt AC 28 ms 14336 KB
b2.txt AC 27 ms 11264 KB
b3.txt AC 28 ms 14336 KB
b4.txt AC 27 ms 11264 KB
b5.txt AC 28 ms 11264 KB
sample1.txt AC 3 ms 4352 KB
sample2.txt AC 3 ms 4352 KB
sample3.txt AC 3 ms 4352 KB
sample4.txt AC 3 ms 4352 KB