Submission #352440

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

Compilation message (stderr)

cave.cpp: In function 'int T()':
cave.cpp:6:33: warning: suggest parentheses around '+' in operand of '&' [-Wparentheses]
    6 | int T(){return tryCombination(c)+8192&8191;}
      |                ~~~~~~~~~~~~~~~~~^~~~~
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:12:10: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   12 |       m=l+r>>1;
      |         ~^~
cave.cpp:14:24: error: third operand to the conditional operator is of type 'void', but the second operand is neither a throw-expression nor of type 'void'
   14 |       T()>i?a[i]=m,A(m),r=m-1:A(m),l=m+1;
      |             ~~~~~~~~~~~^~~~~~