Submission #80290

# Submission time Handle Problem Language Result Execution time Memory
80290 2018-10-19T19:19:44 Z giorgikob Cave (IOI13_cave) C++14
Compilation error
0 ms 0 KB
#include "graderlib.c"
#include "cave.h"
#include<bits/stdc++.h>
using namespace std;
int ans[50005],ans1[50005],S[50005],fix[50005];
void exploreCave(int N) {
    for(int i=0;i<N;i++)
    {
    	for(int j=0;j<N;j++)
    	if(fix[j]==1)
    	S[j]=ans[j];
    	else
    	S[j]=0;
    	
		int x=tryCombination(S);
		bool k=false;//daxuruli
		if(x==-1 || x>i)k=true;bool t=k;//ghia 
		int L=0,R=N-1,ind=0;
		while(L<=R)
		{
			//if(i==7)cout<<L<<" "<<R<<endl;
			int mid=(L+R)/2;
			for(int j=L;j<=mid;j++)
			if(fix[j]==0)
			S[j]=1-S[j];
			
			x=tryCombination(S);
			bool w=false;//daxuruli
			if(x==-1 || x>i)
			w=true;//ghia
			
			if(k!=w)
			R=mid-1,ind=mid;
			else
			L=mid+1;
			k=w;
		}
		ans1[ind]=i;fix[ind]=1;//cout<<ind<<" "<<
		(t==true)?ans[ind]=0:ans[ind]=1;
		//if(ans[i]!=0)ans[i]=0;
	}
	//for(int i=0;i<N;i++)
	//cout<<ans1[i]<<" ";
	answer(ans,ans1);
}
int main() {
    int N;
	N = init();
	exploreCave(N);
    printf("INCORRECT\nYour solution did not call answer().\n");
	return 0;
}

Compilation message

In file included from cave.cpp:1:0:
graderlib.c:8:23: error: expected unqualified-id before 'do'
 #define fail(s, x...) do { \
                       ^
graderlib.c:11:4: error: expected unqualified-id before 'while'
  } while(0)
    ^
/usr/include/c++/7/bits/basic_ios.h: In member function 'std::basic_ios<_CharT, _Traits>::operator bool() const':
graderlib.c:8:23: error: expected unqualified-id before 'do'
 #define fail(s, x...) do { \
                       ^
graderlib.c:8:23: error: expected ';' before 'do'
/usr/include/c++/7/bits/basic_ios.h: In member function 'bool std::basic_ios<_CharT, _Traits>::operator!() const':
graderlib.c:8:23: error: expected unqualified-id before 'do'
 #define fail(s, x...) do { \
                       ^
graderlib.c:8:23: error: expected ';' before 'do'
/usr/include/c++/7/bits/ostream.tcc: In member function 'std::basic_ostream<_CharT, _Traits>::pos_type std::basic_ostream<_CharT, _Traits>::tellp()':
graderlib.c:8:23: error: expected unqualified-id before 'do'
 #define fail(s, x...) do { \
                       ^
graderlib.c:8:23: error: expected ')' before 'do'
/usr/include/c++/7/bits/ostream.tcc: In member function 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::seekp(std::basic_ostream<_CharT, _Traits>::pos_type)':
graderlib.c:8:23: error: expected unqualified-id before 'do'
 #define fail(s, x...) do { \
                       ^
graderlib.c:8:23: error: expected ')' before 'do'
/usr/include/c++/7/bits/ostream.tcc: In member function 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::seekp(std::basic_ostream<_CharT, _Traits>::off_type, std::ios_base::seekdir)':
graderlib.c:8:23: error: expected unqualified-id before 'do'
 #define fail(s, x...) do { \
                       ^
graderlib.c:8:23: error: expected ')' before 'do'
/usr/include/c++/7/bits/istream.tcc: In member function 'std::basic_istream<_CharT, _Traits>::pos_type std::basic_istream<_CharT, _Traits>::tellg()':
graderlib.c:8:23: error: expected unqualified-id before 'do'
 #define fail(s, x...) do { \
                       ^
graderlib.c:8:23: error: expected ')' before 'do'
/usr/include/c++/7/bits/istream.tcc: In member function 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::seekg(std::basic_istream<_CharT, _Traits>::pos_type)':
graderlib.c:8:23: error: expected unqualified-id before 'do'
 #define fail(s, x...) do { \
                       ^
graderlib.c:8:23: error: expected ')' before 'do'
/usr/include/c++/7/bits/istream.tcc: In member function 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::seekg(std::basic_istream<_CharT, _Traits>::off_type, std::ios_base::seekdir)':
graderlib.c:8:23: error: expected unqualified-id before 'do'
 #define fail(s, x...) do { \
                       ^
graderlib.c:8:23: error: expected ')' before 'do'
/usr/include/c++/7/bits/regex.tcc: In member function 'int std::__cxx11::regex_traits< <template-parameter-1-1> >::value(_Ch_type, int) const':
graderlib.c:8:23: error: expected unqualified-id before 'do'
 #define fail(s, x...) do { \
                       ^
graderlib.c:8:23: error: expected ';' before 'do'
In file included from /usr/include/c++/7/bits/regex.h:2802:0,
                 from /usr/include/c++/7/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110,
                 from cave.cpp:3:
/usr/include/c++/7/bits/regex.tcc:354:26: error: expected ';' before '?' token
       return __is.fail() ? -1 : __v;
                          ^
/usr/include/c++/7/bits/regex.tcc:354:26: error: expected primary-expression before '?' token
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:17:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   if(x==-1 || x>i)k=true;bool t=k;//ghia 
   ^~
cave.cpp:17:26: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   if(x==-1 || x>i)k=true;bool t=k;//ghia 
                          ^~~~