Submission #352437

#TimeUsernameProblemLanguageResultExecution timeMemory
352437David_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:8: error: named return values are no longer supported
    6 | int T()return tryCombination(c)+8192&8191;
      |        ^~~~~~
cave.cpp:8:12: error: 'N' was not declared in this scope
    8 |     for(;i<N;i++){
      |            ^
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;
      |             ~~~~~~~~~~~^~~~~~
cave.cpp:19:1: warning: no return statement in function returning non-void [-Wreturn-type]
   19 | }
      | ^