Submission #464730

#TimeUsernameProblemLanguageResultExecution timeMemory
464730AdamGSCave (IOI13_cave)C++14
0 / 100
190 ms408 KiB
#include "cave.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const int LIM=1e3+7;
void exploreCave(int N) {
	int S[N], D[N];
	rep(i, N) {
		S[i]=0;
		D[i]=-1;
	}
	int lst=tryCombination(S);
	rep(i, N) {
		int p=0, k=N-1;
		while(p<k) {
			int sr=(p+k)/2;
			for(int j=p; j<=sr; ++j) if(D[j]==-1) S[j]^=1;
			int nowe=tryCombination(S);
			if(nowe>i && lst>i || nowe==i && lst==i) p=sr+1; else k=sr;
			lst=nowe;
		}
		D[i]=p;
		if(lst==i) S[i]^=1;
	}
	answer(S, D);
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:25:14: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   25 |    if(nowe>i && lst>i || nowe==i && lst==i) p=sr+1; else k=sr;
      |       ~~~~~~~^~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...