# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
669608 | hyakup | Cave (IOI13_cave) | C++17 | Compilation error | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "graderlib.c"
#include <bits/stdc++.h>
using namespace std;
const int maxn = 5010;
int S[maxn], D[maxn];
bool marc[maxn];
int descobre( int ini, int fim, int id, bool open, int S_[] ){
for( int i = ini, i <= fim, i++ ){
if( marc[i] ) continue;
S_[i] = 1^S_[i];
}
int query = tryCombination(S);
int open_ = ( id == query ) ? false : true;
if( ini == fim ){
if( open != open_ ){
if( open_ ) S[ini] = S_[ini];
else S[ini] = 1^S_[ini];
return ini;
}
return -1;
}
if( open != open_ ){
int mid = ( ini + fim )/2;
return max( descobre( ini, mid, id, open_ ), descobre( mid + 1, fim, id, open_ ) );
}
return -1;
}
void exploreCave( int n ){
int init_query = tryCombination(S);
for( int i = 0; i < n; i++ ){
bool open = ( i < init_query ) ? true : false;
int idSwitch = descobre( 0, n - 1, i, open, S );
D[idSwitch] = i;
marc[idSwitch] = true;
}
}
int main() {
int N;
N = init();
exploreCave(N);
printf("INCORRECT\nYour solution did not call answer().\n");
return 0;
}
Compilation message (stderr)
cave.cpp:20:34: warning: `\U0000037e' is not in NFC [-Wnormalized=] 20 | int query = tryCombination(S); | ^ cave.cpp:48:39: warning: `\U0000037e' is not in NFC [-Wnormalized=] 48 | int init_query = tryCombination(S); | ^ In file included from cave.cpp:1: graderlib.c:8:23: error: expected unqualified-id before 'do' 8 | #define fail(s, x...) do { \ | ^~ graderlib.c:11:4: error: expected unqualified-id before 'while' 11 | } while(0) | ^~~~~ /usr/include/c++/10/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' 8 | #define fail(s, x...) do { \ | ^~ In file included from /usr/include/c++/10/ios:44, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from cave.cpp:2: /usr/include/c++/10/bits/basic_ios.h:118:23: error: expected ';' before 'do' 118 | { return !this->fail(); } | ^ | ; In file included from cave.cpp:1: /usr/include/c++/10/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' 8 | #define fail(s, x...) do { \ | ^~ In file included from /usr/include/c++/10/ios:44, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from cave.cpp:2: /usr/include/c++/10/bits/basic_ios.h:126:22: error: expected ';' before 'do' 126 | { return this->fail(); } | ^ | ; In file included from cave.cpp:1: /usr/include/c++/10/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' 8 | #define fail(s, x...) do { \ | ^~ In file included from /usr/include/c++/10/ostream:784, from /usr/include/c++/10/istream:39, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from cave.cpp:2: /usr/include/c++/10/bits/ostream.tcc:242:15: error: expected ')' before 'do' 242 | if (!this->fail()) | ~ ^ | ) In file included from cave.cpp:1: /usr/include/c++/10/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' 8 | #define fail(s, x...) do { \ | ^~ In file included from /usr/include/c++/10/ostream:784, from /usr/include/c++/10/istream:39, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from cave.cpp:2: /usr/include/c++/10/bits/ostream.tcc:263:15: error: expected ')' before 'do' 263 | if (!this->fail()) | ~ ^ | ) In file included from cave.cpp:1: /usr/include/c++/10/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' 8 | #define fail(s, x...) do { \ | ^~ In file included from /usr/include/c++/10/ostream:784, from /usr/include/c++/10/istream:39, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from cave.cpp:2: /usr/include/c++/10/bits/ostream.tcc:295:15: error: expected ')' before 'do' 295 | if (!this->fail()) | ~ ^ | ) In file included from cave.cpp:1: /usr/include/c++/10/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' 8 | #define fail(s, x...) do { \ | ^~ In file included from /usr/include/c++/10/istream:991, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from cave.cpp:2: /usr/include/c++/10/bits/istream.tcc:835:19: error: expected ')' before 'do' 835 | if (!this->fail()) | ~ ^ | ) In file included from cave.cpp:1: /usr/include/c++/10/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' 8 | #define fail(s, x...) do { \ | ^~ In file included from /usr/include/c++/10/istream:991, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from cave.cpp:2: /usr/include/c++/10/bits/istream.tcc:865:19: error: expected ')' before 'do' 865 | if (!this->fail()) | ~ ^ | ) In file included from cave.cpp:1: /usr/include/c++/10/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' 8 | #define fail(s, x...) do { \ | ^~ In file included from /usr/include/c++/10/istream:991, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from cave.cpp:2: /usr/include/c++/10/bits/istream.tcc:904:19: error: expected ')' before 'do' 904 | if (!this->fail()) | ~ ^ | ) In file included from cave.cpp:1: /usr/include/c++/10/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' 8 | #define fail(s, x...) do { \ | ^~ In file included from /usr/include/c++/10/bits/regex.h:2982, from /usr/include/c++/10/regex:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110, from cave.cpp:2: /usr/include/c++/10/bits/regex.tcc:348:19: error: expected ';' before 'do' 348 | return __is.fail() ? -1 : __v; | ^ | ; /usr/include/c++/10/bits/regex.tcc:348:26: error: expected ';' before '?' token 348 | return __is.fail() ? -1 : __v; | ^ /usr/include/c++/10/bits/regex.tcc:348:26: error: expected primary-expression before '?' token cave.cpp: In function 'int descobre(int, int, int, bool, int*)': cave.cpp:12:24: error: expected ';' before '<=' token 12 | for( int i = ini, i <= fim, i++ ){ | ^~~ | ; cave.cpp:12:25: error: expected primary-expression before '<=' token 12 | for( int i = ini, i <= fim, i++ ){ | ^~ cave.cpp:12:36: error: expected ';' before ')' token 12 | for( int i = ini, i <= fim, i++ ){ | ^~ | ; cave.cpp:20:34: error: expected ',' or ';' before '\U0000037e' 20 | int query = tryCombination(S); | ^ cave.cpp:26:21: error: 'open_' was not declared in this scope; did you mean 'open'? 26 | if( open != open_ ){ | ^~~~~ | open cave.cpp:36:17: error: 'open_' was not declared in this scope; did you mean 'open'? 36 | if( open != open_ ){ | ^~~~~ | open cave.cpp:20:9: warning: unused variable 'query' [-Wunused-variable] 20 | int query = tryCombination(S); | ^~~~~ cave.cpp: In function 'void exploreCave(int)': cave.cpp:48:39: error: expected ',' or ';' before '\U0000037e' 48 | int init_query = tryCombination(S); | ^ cave.cpp:50:21: error: 'i' was not declared in this scope 50 | for( int i = 0; i < n; i++ ){ | ^ cave.cpp:48:9: warning: unused variable 'init_query' [-Wunused-variable] 48 | int init_query = tryCombination(S); | ^~~~~~~~~~