Submission #1172084

#TimeUsernameProblemLanguageResultExecution timeMemory
1172084jakubmz2동굴 (IOI13_cave)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; typedef long long ll; const int MAXN = 5e3 + 5; int ktory[MAXN]; int good[MAXN]; int query(int a, int b, int kt, int n){ bool q[n]; for(int i = 0; i < n; ++i){ if(good[i] != -1){ q[i] = good[i]; } else{ if(i >= a and i <= b){ q[i] = kt; } else{ q[i] = (kt ^ 1); } } } return tryCombination(q); } void obl(int i, int n){ bool q[n]; for(int i = 0; i < n; ++i){ if(good[i] != -1){ q[i] = good[i]; } else{ q[i] = 0; } } int j = tryCombination(q); int kt; if(j > i or j == -1){ kt = 0; } else{ kt = 1; } //cout << kt << "\n"; int p = 0; int k = n - 1; int x, y; while(p != k){ int sr = (p + k) / 2; //cout << p << " " << sr << " " << kt << "\n"; for(int i = p; i <= k; ++i){ if(good[i] != -1){ q[i] = good[i]; } else{ if(i <= sr){ q[i] = kt; } else{ q[i] = (kt ^ 1); } } } int x = tryCombination(q); if(x > i or x == -1){ k = sr; } else{ for(int i = p; i <= k; ++i){ if(good[i] != -1){ q[i] = good[i]; } else{ if(i <= sr){ q[i] = (kt ^ 1); } else{ q[i] = kt; } } } p = sr + 1; } } //cout << i << " " << p << "\n"; good[p] = kt; ktory[p] = i; return; } void exploreCave(int n){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); for(int i = 0; i < n; ++i){ good[i] = -1; ktory[i] = -1; } for(int i = 0; i < n; ++i){ obl(i, n); } bool U[n]; int P[n]; for(int i = 0; i < n; ++i){ U[i] = good[i]; P[i] = ktory[i]; } answer(U, P); return; }

Compilation message (stderr)

cave.cpp: In function 'int query(int, int, int, int)':
cave.cpp:26:27: error: cannot convert 'bool*' to 'int*'
   26 |     return tryCombination(q);
      |                           ^
      |                           |
      |                           bool*
In file included from cave.cpp:2:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp: In function 'void obl(int, int)':
cave.cpp:40:28: error: cannot convert 'bool*' to 'int*'
   40 |     int j = tryCombination(q);
      |                            ^
      |                            |
      |                            bool*
In file included from cave.cpp:2:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:69:32: error: cannot convert 'bool*' to 'int*'
   69 |         int x = tryCombination(q);
      |                                ^
      |                                |
      |                                bool*
In file included from cave.cpp:2:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:114:12: error: cannot convert 'bool*' to 'int*'
  114 |     answer(U, P);
      |            ^
      |            |
      |            bool*
In file included from cave.cpp:2:
cave.h:9:17: note:   initializing argument 1 of 'void answer(int*, int*)'
    9 | void answer(int S[], int D[]);
      |             ~~~~^~~