AtCoder Grand Contest 017

Submission #3453459

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;
    for(auto to:v[x]){
        if(to==p)continue;
        ret^=dfs(to,x)+1;
    }
    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状態 AC
Score得点 1100
Source lengthソースコード長 922 Byte
File nameファイル名
Exec time実行時間 105 ms
Memory usageメモリ使用量 10368 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample - sample1.txt,sample2.txt,sample3.txt,sample4.txt
All 1100 / 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 AC 10 ms 3072 KB
a11.txt AC 10 ms 3072 KB
a12.txt AC 10 ms 3072 KB
a13.txt AC 91 ms 5888 KB
a14.txt AC 90 ms 5888 KB
a15.txt AC 72 ms 5248 KB
a16.txt AC 91 ms 6016 KB
a17.txt AC 92 ms 6016 KB
a18.txt AC 90 ms 6016 KB
a19.txt AC 87 ms 6784 KB
a2.txt AC 4 ms 2688 KB
a20.txt AC 93 ms 6912 KB
a21.txt AC 73 ms 6144 KB
a22.txt AC 91 ms 5888 KB
a23.txt AC 90 ms 5888 KB
a24.txt AC 73 ms 5248 KB
a25.txt AC 90 ms 6016 KB
a26.txt AC 91 ms 6016 KB
a27.txt AC 90 ms 6016 KB
a28.txt AC 90 ms 6784 KB
a29.txt AC 91 ms 6912 KB
a3.txt AC 6 ms 2816 KB
a30.txt AC 74 ms 6144 KB
a4.txt AC 10 ms 2944 KB
a5.txt AC 10 ms 2944 KB
a6.txt AC 10 ms 2944 KB
a7.txt AC 10 ms 2944 KB
a8.txt AC 10 ms 2944 KB
a9.txt AC 10 ms 2944 KB
b1.txt AC 93 ms 10368 KB
b2.txt AC 94 ms 8064 KB
b3.txt AC 93 ms 10368 KB
b4.txt AC 93 ms 8064 KB
b5.txt AC 105 ms 8064 KB
sample1.txt AC 2 ms 2560 KB
sample2.txt AC 2 ms 2560 KB
sample3.txt AC 2 ms 2560 KB
sample4.txt AC 2 ms 2560 KB