답안 #149682

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
149682 2019-09-01T06:57:19 Z Fenwick_team(#3609, amiratou, AyaBenSaad, Nucleist) Bulb Game (FXCUP4_bulb) C++17
0 / 100
2 ms 376 KB
#include "bulb.h"
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define rando mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define fi first
#define se second
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define debugii(x) cerr << " - " << #x << ": " << x.fi<<","<<x.se << endl;
#define sep() cerr << "--------------------" << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ll long long
#define ii pair<int,int>
#define v vector<int>
#define vii vector<ii>
#define vv vector<vector<int> >
#define mp make_pair
#define INF 1000000000
#define pb push_back
#define EPS 1e-9
const int MOD = 1000000007; // 998244353
v LL,RR;
vector<int> state;
bool flow(int node){
	if(node<0){
		if(node==-2)return 1;
		return 0;
	}
	return flow((state[node]?RR[node]:LL[node]));
}

int FindWinner(int T, v L, v R){
	LL=L,RR=R;
	int N = L.size();
	state.resize(N);
	fill(all(state),0);
	for (int i = 0;i>=0; i=(state[i]?R[i]:L[i])){
		state[i]=1-state[i];
		bool f=1;
		for (int j = 0;j>=0; j=(state[j]?R[j]:L[j])){
			state[j]=1-state[j];
			if(flow((state[j]?R[j]:L[j]))){
				f=0;
				state[j]=1-state[j];
				break;
			}
			state[j]=1-state[j];
		}
		if(f){
			for (int j = 0;j>=0; j=(state[j]?R[j]:L[j])){
				if((state[j]?R[j]:L[j])<0){
					if((state[j]?R[j]:L[j])==-1)return 1;
					else break;
				}
			}

		}
		state[i]=1-state[i];
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 348 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -