Submission #815076

#TimeUsernameProblemLanguageResultExecution timeMemory
815076OrazBCave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "cave.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
#define ll long long int
#define pii pair <int, int>
#define pb push_back
#define ff first
#define ss second

const int N = 5e3+5;
int vis[N];

void exploreCave(int n){
	int S[n], D[n];
	for (int i = 0; i < n; i++){
		S[i] = 0;
	}
	int x = tryCombination(S);
	for (int i = 0; i < n; i++){
		int l = 0, r = n-1;
		while(l <= r){
			int md = (l+r)>>1;
			for (int j = md; j < n; j++){
				if (!vis[j]) S[j] = !S[j];
			}
			int new_x = tryCombination(S);
			if (i == x){
				if (new_x == x) r = md - 1;
				else{
					pos = md;
					l = md + 1;
				}
			}else{
				if (new_x == x){
					pos = md;
					l = md + 1;
				}else r = md - 1;
			}
			for (int j = md; j < n; j++){
				if (!vis[j]) S[j] = !S[j];
			}
		}
		D[i] = pos;
		vis[pos] = 1;
		if (i == x) S[pos] = !S[pos];
	}
	answer(S, D);
}

// int main ()
// {
// 	ios::sync_with_stdio(false);
// 	cin.tie(0);
// 	cin >> t;
// 	while (t--){
		
// 	}
// }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:31:6: error: 'pos' was not declared in this scope; did you mean 'pow'?
   31 |      pos = md;
      |      ^~~
      |      pow
cave.cpp:36:6: error: 'pos' was not declared in this scope; did you mean 'pow'?
   36 |      pos = md;
      |      ^~~
      |      pow
cave.cpp:44:10: error: 'pos' was not declared in this scope; did you mean 'pow'?
   44 |   D[i] = pos;
      |          ^~~
      |          pow