Submission #145741

#TimeUsernameProblemLanguageResultExecution timeMemory
145741MathStudent2002Cave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; const int MAXM = 5005; int M; int pos[MAXM]; int loc[MAXM]; int cur; int exp[MAXM]; void found(int known, int L, int R) { for(int i = 0; i < M; i++) {exp[i] = 1-known;} for(int i = L; i <= R; i++) {exp[i] = known;} for(int i = 0; i < cur; i++) {exp[loc[i]] = pos[i];} } void exploreCave(int N) { M = N; int check[M]; for(int i = 0; i < M; i++) {pos[i] = -1; loc[i] = -1;} int curpos; int res; for(cur = 0; cur < M; cur++) { found(0, 0, M-1); for(int j = 0; j < M; j++) { check[j] = exp[j]; } res = tryCombination(check); curpos = 0; if(res == cur) {curpos = 1;} pos[cur] = curpos; int lo = 0, hi = M-1; int mi; while(hi != lo) { mi = (lo+hi)/2; found(curpos,lo,mi); for(int j = 0; j < M; j++) {check[j] = exp[j];} res = tryCombination(check); if(res == cur) {lo = mi+1;} else hi = mi; } loc[cur] = lo; } int ansloc[M]; int anspos[M]; for(int i = 0; i < M; i++) { ansloc[i] = loc[i]; anspos[loc[i]] = pos[i]; } answer(anspos, ansloc); }

Compilation message (stderr)

cave.cpp:12:13: error: 'int exp [5005]' redeclared as different kind of symbol
 int exp[MAXM];
             ^
In file included from /usr/include/features.h:367:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h:533,
                 from /usr/include/c++/7/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:33,
                 from cave.cpp:2:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:100:1: note: previous declaration 'double exp(double)'
 __MATHCALL_VEC (exp,, (_Mdouble_ __x));
 ^
cave.cpp: In function 'void found(int, int, int)':
cave.cpp:15:38: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
     for(int i = 0; i < M; i++) {exp[i] = 1-known;}
                                      ^
cave.cpp:16:39: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
     for(int i = L; i <= R; i++) {exp[i] = known;}
                                       ^
cave.cpp:17:45: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
     for(int i = 0; i < cur; i++) {exp[loc[i]] = pos[i];}
                                             ^
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:33:29: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
             check[j] = exp[j];
                             ^
cave.cpp:45:57: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
             for(int j = 0; j < M; j++) {check[j] = exp[j];}
                                                         ^