제출 #738955

#제출 시각아이디문제언어결과실행 시간메모리
7389551ne게임 (IOI14_game)C++14
컴파일 에러
0 ms0 KiB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
vector<int>res;
struct DSU{
	vector<int>parent,sz;
	DSU(int n){
		parent.resize(n);
		sz.resize(n,1);
		iota(parent.begin(),parent.end(),0);
	}
	int findsets(int v){
		if (v == parent[v]){
			return v;
		}
		parent[v] = findsets(parent[v]);
		return parent[v];
	}
	bool unionset(int u,int v){
		u = findsets(u);
		v = findsets(v);
		if (u == v){
			return false;
		}
		if (sz[v] > sz[u]){
			swap(u,v);
		}
		parent[v] = u;
		sz[u]+=sz[v];
		return true;
	};
};
DSU st(1501);
vector<int>with;
void initialize(int n) {
	res.resize(n,n - 1);
	with.resize(n,0);
}

int hasEdge(int u, int v) {
	 if (st.findsets(u) == st.findsets(v)){
	 	res[u]--;
	 	res[v]--;
	 	return 0;
	 }
	 if ((res[u] == 1 && res[v] >= 1) || (res[v] == 1 && res[u] >= 1)){
	 	st.unionset(u,v);     
	 	res[u]--;
	 	res[v]--;
	 	with[u] = 1;
	 	with[v] = 1;
	 	checked[u][v] = 1;
	 	checked[v][u] = 1;
	 	return 1;
	 }
	 res[u]--;
	 res[v]--;
	 return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:52:4: error: 'checked' was not declared in this scope
   52 |    checked[u][v] = 1;
      |    ^~~~~~~