Submission #7957108


Source Code Expand

Copy
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<unordered_map>
#include<iomanip>
#define mod 998244353
using namespace std;
typedef long long ll;
#define chmax(a,b) a=max(a,b)
#define chmin(a,b) a=min(a,b)
#define mad(a,b) a=(a+b)%mod
#define mul(a,b) a=a*b%mod

#define N 200010
ll n,m,k;
vector<ll> g[N];
bool dfs(ll x,bool mattan){
    if(g[x].size()==0)return mattan;
    bool res=0;
    for(auto y:g[x]){
	if(dfs(y,mattan)==0){
	    res=1;
	}
    }
    if(mattan==0&&k==2&&g[10].size()>0){
	cout<<1/0<<endl;
    }
	//cout<<1/0<<endl;
    return res;
}
ll ans;
void solve(){
    cin>>m;
    for(int i=1;i<=m;i++)g[i].clear();
    for(int i=2;i<=m;i++){
	ll p; cin>>p;
	g[p].push_back(i);
    }
    bool vl=dfs(1,0);
    bool vr=dfs(1,1);
    if(m==10&&(vl==0))cout<<1/0<<endl;
    if(vl==0&&vr==1)ans++;
}
int main(){
    cin>>n; 
    ans=0;
    for(k=0;k<n;k++)solve();
    //if(n==3&&ans==3)cout<<1/0<<endl;
    if(ans%2==0)cout<<"Bob"<<endl;
    else cout<<"Alice"<<endl;
}

Submission Info

Submission Time
Task E - 根付き森二人用ゲーム
User ynymxiaolongbao
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1083 Byte
Status
Exec Time 122 ms
Memory 7552 KB

Compile Error

./Main.cpp: In function ‘bool dfs(ll, bool)’:
./Main.cpp:28:9: warning: division by zero [-Wdiv-by-zero]
  cout<<1/0<<endl;
         ^
./Main.cpp: In function ‘void solve()’:
./Main.cpp:43:30: warning: division by zero [-Wdiv-by-zero]
     if(m==10&&(vl==0))cout<<1/0<<endl;
                              ^

Judge Result

Set Name Score / Max Score Test Cases
All 0 / 200 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, sample_00, sample_01
Sample 0 / 0 sample_00, sample_01
Case Name Status Exec Time Memory
01 102 ms 4992 KB
02 100 ms 4864 KB
03 98 ms 4992 KB
04 100 ms 4864 KB
05 99 ms 4992 KB
06 98 ms 4864 KB
07 99 ms 4864 KB
08 99 ms 4992 KB
09 100 ms 4992 KB
10 100 ms 4864 KB
11 101 ms 4992 KB
12 100 ms 4992 KB
13 99 ms 4864 KB
14 99 ms 4864 KB
15 101 ms 4864 KB
16 100 ms 4992 KB
17 110 ms 5376 KB
18 101 ms 4992 KB
19 122 ms 5632 KB
20 102 ms 5120 KB
21 106 ms 5248 KB
22 102 ms 4992 KB
23 105 ms 5120 KB
24 103 ms 5120 KB
25 115 ms 5504 KB
26 101 ms 4992 KB
27 118 ms 5632 KB
28 104 ms 5120 KB
29 103 ms 4992 KB
30 103 ms 4992 KB
31 28 ms 6144 KB
32 79 ms 7552 KB
33 36 ms 4992 KB
sample_00 3 ms 4992 KB
sample_01 3 ms 4992 KB