Submission #148927

# Submission time Handle Problem Language Result Execution time Memory
148927 2019-09-01T05:24:27 Z 还没编好(#3801, cauchysheep, fjzzq2002, apiad) Bulb Game (FXCUP4_bulb) C++17
0 / 100
2 ms 376 KB
#include "bulb.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

const int N=301000;
VI l,r;
int n;
int gol[N],gor[N];

int dfs(int u) {
	if (u<0) return u;
	else {
		gol[u]=dfs(l[u]);
		gor[u]=dfs(r[u]);
		return gol[u];
	}
}

int FindWinner(int T, std::vector<int> L, std::vector<int> R){
	T=T%2; l=L; r=R;
	n=L.size();
	dfs(0);
	if (T==1) {
		int p=0;
		while (p>0) {
			if (gor[p]==-1) return 1;
			p=l[p];
		}
		return 0;
	} else {
		if (gol[0]==-2) return 0;
		return rand()%2;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -