답안 #852774

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
852774 2023-09-22T16:44:50 Z drkarlicio2107 경찰관과 강도 (BOI14_coprobber) C++14
컴파일 오류
0 ms 0 KB
#include "coprobber.h"
#include <bits/stdc++.h>
using namespace std;
int kol [510][510][2];
int st [510][510][2];
queue < pair <int, pair <int, int> > > kju;
int mov [510][510];

int curr;
int start (int n, bool l [510][510]){
	for (int i=0; i<n; i++){
		for (int j=0; j<n; j++){
			int uk=0;
			for (int k=0; k<n; k++) uk+=l [j][k];
			kol [i][j][0]=1;
			kol [i][j][1]=uk;
			if (i==j){
				kju.push ({0, {i, j}});
				kju.push ({1, {i, j}});
			}
		}
	}
	while (!kju.empty()){
		int m=kju.front().first;
		int a=kju.front().second.first;
		int b=kju.front().second.second;
		//cout << m << " " << a << " " << b << endl;
		st [m][a][b]=1;
		if (m==0){
			for (int i=0; i<n; i++){
				if (!l [i][b]) continue;
				kol [a][i][1]--;
				if (kol [a][i][1]==0){
					kju.push ({1, {a, i}});
				}
			}
		}
		else {
			for (int i=0; i<n; i++){
				if (!l [i][a]) continue;
				kol [i][b][0]--;
				if (kol [i][b][0]==0){
					kju.push ({0, {i, b}});
					mov [i][b]=a;
				}
			}
		}
		kju.pop();
	}
	for (int i=0; i<n; i++){
		int uk=0;
		for (int j=0; j<n; j++) uk+=st [1][i][j];
		if (uk==n) return curr=i;
	}
	return -1;
}
int nextMove (int x){
	return curr=mov [curr][x];
}
int a [510][510];
/*int main(){
	int n; cin >> n; 
	for (int i=0; i<n; i++){
		for (int j=0; j<n; j++) cin >> a [i][j];
	}
	cout << start (n, a) << endl;
	while (true){
		int x; cin >> x;
		if (x==-1) break;
		cout << nextMove (x) << endl;
	}
	return 0;
}*/

Compilation message

/usr/bin/ld: /tmp/ccbnaOgS.o: in function `main':
grader.cpp:(.text.startup+0x16c): undefined reference to `start(int, bool (*) [500])'
collect2: error: ld returned 1 exit status