Submission #354329

#TimeUsernameProblemLanguageResultExecution timeMemory
354329David_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;
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<N;i++){
		l=0,r=N-1;
    	if(T())A(r);
    	while(l<r)m=l+r>>1,A(m),T()?r=m,A(m):l=m+1,A(m);
		a[l]=i,f[l]=1;
	}answer(c,a);
}

Compilation message (stderr)

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