Submission #817999

#TimeUsernameProblemLanguageResultExecution timeMemory
817999OAleksaCave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> //#include "factories.h" //#include "wall.h" #include "cave.h" #define f first #define s second #define int long long using namespace std; // const int maxn = 5010; // vector<int> kurac(maxn), kurac2(maxn); // int n; // int tryCombination(int s[]) { // int x = 1; // for(int i = 0;i < n;i++) { // if(kurac[i] == s[i]) // ++x; // else // break; // } // if(x == n) // x = -1; // return x; // } void exploreCave(int N) { int a[N], d[N]; for(int i = 0;i < N;i++) a[i] = 0; for(int i = 0;i < N;i++) d[i] = -1; vector<int> vis(N); for(int i = 1;i <= N;i++) { //trazim suprotno od o int l = 0, r = N - 1; int br = tryCombination(a); int o = (br > i || br == -1); while(l < r) { int mid = (l + r) / 2; for(int j = l;j <= mid;j++) { if(!vis[j]) a[j] = !a[j]; } br = tryCombination(a); int o1 = (br > i || br == -1); if(o != o1) r = mid; else l = mid + 1; o = o1; } vis[l] = 1; a[l] = !s[l]; d[l] = i; } answer(a, d); } // signed main() // { // ios_base::sync_with_stdio(false); // cin.tie(0); // cout.tie(0); // int tt = 1; // //cin >> tt; // while(tt--) { // cin >> n; // for(int i = 0;i < n;i++) // cin >> kurac[i]; // for(int i = 0;i < n;i++) // cin >> kurac2[i]; // exploreCave(n); // } // return 0; // }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(long long int)':
cave.cpp:35:29: error: cannot convert 'long long int*' to 'int*'
   35 |     int br = tryCombination(a);
      |                             ^
      |                             |
      |                             long long int*
In file included from cave.cpp:4:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:43:26: error: cannot convert 'long long int*' to 'int*'
   43 |      br = tryCombination(a);
      |                          ^
      |                          |
      |                          long long int*
In file included from cave.cpp:4:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:6:11: error: 'second' was not declared in this scope
    6 | #define s second
      |           ^~~~~~
cave.cpp:52:13: note: in expansion of macro 's'
   52 |     a[l] = !s[l];
      |             ^
cave.cpp:55:11: error: cannot convert 'long long int*' to 'int*'
   55 |    answer(a, d);
      |           ^
      |           |
      |           long long int*
In file included from cave.cpp:4:
cave.h:9:17: note:   initializing argument 1 of 'void answer(int*, int*)'
    9 | void answer(int S[], int D[]);
      |             ~~~~^~~