AtCoder Grand Contest 017

Submission #3453394

Source codeソースコード

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

vector<int> v[101010];
int dfs(int x,int p){
    int ret=0,cnt=0;
    for(auto to:v[x]){
        if(to==p)continue;
        ++cnt;
        ret^=dfs(to,x);
    }
    if(cnt==1)ret++;
    return ret;
}

int main(){
    int n;
    cin>>n;
    rep(i,n-1){
        int a,b;
        cin>>a>>b;
        --a;--b;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    cout<<(dfs(0,-1)?"Alice":"Bob")<<endl;
    return 0;
}

Submission

Task問題 D - Game on Tree
User nameユーザ名 てんぷら
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 WA
Score得点 0
Source lengthソースコード長 964 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
Sample - sample1.txt,sample2.txt,sample3.txt,sample4.txt
All 0 / 1100 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

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
a1.txt AC 3 ms 2688 KB
a10.txt WA
a11.txt AC 10 ms 3072 KB
a12.txt AC 10 ms 3072 KB
a13.txt WA
a14.txt WA
a15.txt AC 71 ms 5248 KB
a16.txt AC 92 ms 6144 KB
a17.txt WA
a18.txt WA
a19.txt AC 88 ms 7168 KB
a2.txt WA
a20.txt AC 92 ms 7296 KB
a21.txt AC 75 ms 6400 KB
a22.txt WA
a23.txt AC 91 ms 5888 KB
a24.txt WA
a25.txt WA
a26.txt AC 90 ms 6144 KB
a27.txt AC 92 ms 6144 KB
a28.txt WA
a29.txt AC 93 ms 7296 KB
a3.txt AC 6 ms 2816 KB
a30.txt AC 74 ms 6400 KB
a4.txt WA
a5.txt WA
a6.txt AC 10 ms 2944 KB
a7.txt AC 10 ms 2944 KB
a8.txt WA
a9.txt WA
b1.txt AC 95 ms 12032 KB
b2.txt AC 93 ms 8832 KB
b3.txt AC 95 ms 12032 KB
b4.txt AC 93 ms 8832 KB
b5.txt AC 93 ms 8832 KB
sample1.txt AC 3 ms 2560 KB
sample2.txt AC 2 ms 2560 KB
sample3.txt AC 2 ms 2560 KB
sample4.txt AC 2 ms 2560 KB