Submission #354325

#TimeUsernameProblemLanguageResultExecution timeMemory
354325David_MCave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
int c[5003],f[5003],a[5003],i,j,x,l,r,m,e;
void A(int R){for(;R>=l;R--)c[R]^=!f[R];}
int T(){return(tryCombination(c)+9999)%9999<=i;}
void exploreCave(int N){
	for(i=0;i<N;i++){
		l=0;r=N-1;
		if(T())A(r);
		while(l<r){
			m=l+r>>1;
			A(m);
			e=tryCombination(c);
			if(e!=-1&&e<=i)e=1;
			else e=0;
			e?A(m),r=m:A(m),l=m+1;
		}
		a[l]=i;
		f[l]=1;
	}answer(c,a);
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:12:7: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   12 |    m=l+r>>1;
      |      ~^~
cave.cpp:17:10: error: third operand to the conditional operator is of type 'void', but the second operand is neither a throw-expression nor of type 'void'
   17 |    e?A(m),r=m:A(m),l=m+1;
      |      ~~~~^~~~