Submission #150112

#TimeUsernameProblemLanguageResultExecution timeMemory
150112갓띵건 (#200)Bulb Game (FXCUP4_bulb)C++17
Compilation error
0 ms0 KiB
#include "bulb.h"
#include<bits/stdc++.h>
using namespace std;

#define fast ios::sync_with_stdio(false);cin.tie(0)
#define fi first
#define se second
#define eb emplace_back
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define pre(a) cout<<fixed;cout.precision(a)

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
const int inf = 1e9;
const ll INF = 1e18;

int n;
vector<int> l, r;

int dfs(int x) {
	if(x < 0) return x;
	return dfs(l[x]);
}

int FindWinner(int T, std::vector<int> L, std::vector<int> R){
	n = L.size();
	l = L;
	r = R;

	for(int i=0; i<n; i++) {
		swap(l[i], r[i]);

		flag = true;
		for(int j=0; j>=0; j = l[j]) {
			if(l[j] == -2) flag = false;
			if(dfs(r[j]) == -2) flag = false;
		}

		swap(l[i], r[i]);

		if(flag) return 1;
	}

	return 0;
}

Compilation message (stderr)

bulb.cpp: In function 'int FindWinner(int, std::vector<int>, std::vector<int>)':
bulb.cpp:35:3: error: 'flag' was not declared in this scope
   flag = true;
   ^~~~
bulb.cpp:35:3: note: suggested alternative: 'log'
   flag = true;
   ^~~~
   log