Submission #1216790

#TimeUsernameProblemLanguageResultExecution timeMemory
1216790takoshanavaCave (IOI13_cave)C++20
Compilation error
0 ms0 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; bool vis[5002]; int n, R[5002], D[5002]; void change( int i, int j ){ for( ; i <= j; i++ ) if( !vis[i] ) R[i] = ( R[i] + 1 ) % 2; } void exploreCave(int N) { n = N; for(int i = 0; i < n; i++){ int s, ps, r, ll, rr, m; r = tryCombination( n, R ); if(r > i or r == -1){ s = 0; }else{ s = 1; } ll = 0; rr = n - 1; while(ll != rr){ m = (ll + rr) / 2; change(ll, m); r = tryCombination(n, R); if(r > i or r == -1){ ps = 0; }else{ ps = 1; } change(ll, m); if(ps != s) rr = m; else ll = m + 1; } D[ll] = i; R[ll] = s; vis[ll] = 1; } answer(n, R, D); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:18:29: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   18 |         r = tryCombination( n, R );
      |                             ^
      |                             |
      |                             int
cave.cpp:18:27: error: too many arguments to function 'int tryCombination(int*)'
   18 |         r = tryCombination( n, R );
      |             ~~~~~~~~~~~~~~^~~~~~~~
In file included from cave.cpp:1:
cave.h:8:5: note: declared here
    8 | int tryCombination(int S[]);
      |     ^~~~~~~~~~~~~~
cave.cpp:29:32: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   29 |             r = tryCombination(n, R);
      |                                ^
      |                                |
      |                                int
cave.cpp:29:31: error: too many arguments to function 'int tryCombination(int*)'
   29 |             r = tryCombination(n, R);
      |                 ~~~~~~~~~~~~~~^~~~~~
In file included from cave.cpp:1:
cave.h:8:5: note: declared here
    8 | int tryCombination(int S[]);
      |     ^~~~~~~~~~~~~~
cave.cpp:44:12: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   44 |     answer(n, R, D);
      |            ^
      |            |
      |            int
cave.cpp:44:11: error: too many arguments to function 'void answer(int*, int*)'
   44 |     answer(n, R, D);
      |     ~~~~~~^~~~~~~~~
In file included from cave.cpp:1:
cave.h:9:6: note: declared here
    9 | void answer(int S[], int D[]);
      |      ^~~~~~