답안 #398948

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
398948 2021-05-04T22:47:15 Z shrimb 경찰관과 강도 (BOI14_coprobber) C++17
컴파일 오류
0 ms 0 KB
#include "coprobber.h" 
vector<int> adj[501];
int cur = 0, nig;

int start(int N, bool A[MAX_N][MAX_N]) {
	for (int i = 0 ; i < N ; i++) {
		for (int j = 0 ; j < N ; j++) {
			if (A[i][j]) adj[i].push_back(j);
		}
	}
	return 0;
}

bool check (int c, int p) {
	bool res = 0;
	for (int i : adj[c]) {
		if (i == nig) return 1;
		res |= check(i, c);
	}
	return res;
}

int nextMove(int R) {
	nig = R;
	for (int i : adj[cur]) {
		if (i == R || check(i, cur)) return cur = i;
	}
}

Compilation message

coprobber.cpp:2:1: error: 'vector' does not name a type
    2 | vector<int> adj[501];
      | ^~~~~~
coprobber.cpp: In function 'int start(int, bool (*)[500])':
coprobber.cpp:8:17: error: 'adj' was not declared in this scope
    8 |    if (A[i][j]) adj[i].push_back(j);
      |                 ^~~
coprobber.cpp: In function 'bool check(int, int)':
coprobber.cpp:16:15: error: 'adj' was not declared in this scope
   16 |  for (int i : adj[c]) {
      |               ^~~
coprobber.cpp: In function 'int nextMove(int)':
coprobber.cpp:25:15: error: 'adj' was not declared in this scope
   25 |  for (int i : adj[cur]) {
      |               ^~~