Submission #672752

#TimeUsernameProblemLanguageResultExecution timeMemory
672752Hacv16동굴 (IOI13_cave)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
#include "cave.h"
 
using namespace std;
 
typedef long long ll;
const int MAX = 2e6 + 15;
const int INF = 0x3f3f3f3f;

int S[MAX], D[MAX];
bool mark[MAX];

int findPos(int l, int r, int c, int d){
	if(l == r) return l;
	int m = (l + r) >> 1;

	for(int i = l; i <= m; i++) if(!mark[i]) S[i] = c;
	for(int i = m + 1; i <= r; i++) if(!mark[i]) S[i] = !c;

	int query = tryCombination(S);

	if(query == d) return findPos(m + 1, r, c, d);
	return findPos(l, m, c, d);
}
 
void exploreCave(int n){
	for(int door = 0; door < n; door++){	
		for(int i = 0; i < n; i++)
			if(!mark[i]) S[i] = 0;
 
		int color = (tryCombination(S) == door);
		int pos = findPos(0, n - 1, color);
 
		mark[l] = true;
		D[l] = door;
		S[l] = color;
	}
 
	answer(S, D);
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:32:36: error: too few arguments to function 'int findPos(int, int, int, int)'
   32 |   int pos = findPos(0, n - 1, color);
      |                                    ^
cave.cpp:13:5: note: declared here
   13 | int findPos(int l, int r, int c, int d){
      |     ^~~~~~~
cave.cpp:34:8: error: 'l' was not declared in this scope
   34 |   mark[l] = true;
      |        ^
cave.cpp:32:7: warning: unused variable 'pos' [-Wunused-variable]
   32 |   int pos = findPos(0, n - 1, color);
      |       ^~~