Submission #500905

#TimeUsernameProblemLanguageResultExecution timeMemory
500905aymanrs동굴 (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
int tryCombination(int S[]);//{
// 	cout << "--------------------------------\n";
// 	for(int i = 0;i < n;i++) cout << S[i] << '\n';
// 	cout << "--------------------------------\n";
// 	int r;
// 	cin >> r;
// 	return r;
// }
void answer(int S[], int D[]);//{
// 	for(int i = 0;i < n;i++) cout << S[i] << ' ' << D[i] << '\n';
// }
void exploreCave(int N){
	int S[N] = {0}, D[N];
	vector<int> s;
	for(int i = 0;i < N;i++) s.push_back(i);
	for(int i = 0;i < N;i++){
		for(int j : s) S[j] = 0;
		int l = 0, r = s.size()-1, m, b, g = tryCombination(S), f;
		if(g == -1 || g>i) f = 0;
		else {
			for(int j : s) S[j] = 1;
			f = 1;
		}
		while(l <= r){
			m = (l+r)/2;
			for(int j = l;j <= m;j++) S[s[j]] = 1^f;
			g = tryCombination(S);
			for(int j = l;j <= m;j++) S[s[j]] = f;
			if(g != -1 && g <= i){
				b = m;
				r = m-1;
			} else {
				l = m+1;
			}
		}
		D[s[b]] = i;
		S[s[b]] = f;
		s.erase(s.begin()+b);
	}
	answer(S, D);
}
// int main(){
// 	exploreCave(n);
// }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:38:8: warning: 'b' may be used uninitialized in this function [-Wmaybe-uninitialized]
   38 |   D[s[b]] = i;
      |        ^
/usr/bin/ld: /tmp/ccEKJ8Ca.o: in function `exploreCave(int)':
cave.cpp:(.text+0x1ad): undefined reference to `tryCombination(int*)'
/usr/bin/ld: cave.cpp:(.text+0x224): undefined reference to `tryCombination(int*)'
/usr/bin/ld: cave.cpp:(.text+0x2e0): undefined reference to `answer(int*, int*)'
/usr/bin/ld: /tmp/ccLINNEc.o: in function `main':
grader.c:(.text.startup+0x10): undefined reference to `exploreCave'
collect2: error: ld returned 1 exit status