Submission #1312201

#TimeUsernameProblemLanguageResultExecution timeMemory
1312201orgiloogiiCave (IOI13_cave)C++20
Compilation error
0 ms0 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; #define ll long long void exploreCave(int n) { int res[n]; int state[n]; for (int i = 0;i < n;i++) { state[i] = -1; res[i] = -1; } int temp[n]; for (int i = 0;i < n;i++) { int onstate = -1; for (int i = 0;i < n;i++) { if (state[i] == -1) temp[i] = 0; else temp[i] = state[i]; } int block = tryCombination(temp); if (block == i) { onstate = 1; } else { onstate = 0; } int l = 0, r = n + 1; while (l + 1 < r) { int mid - (l + r) / 2; for (int i = l;i <= mid;i++) { if (state[i] == -1) temp[i] = onstate; else temp[i] = state[i]; } block = tryCombination(temp); if (block == i) { l = mid; } else { r = mid; } } state[l] = onstate; res[i] = l; } answer(state, res); } //int main() { // //}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:28:21: error: expected initializer before '-' token
   28 |             int mid - (l + r) / 2;
      |                     ^
cave.cpp:29:33: error: 'mid' was not declared in this scope
   29 |             for (int i = l;i <= mid;i++) {
      |                                 ^~~
cave.cpp:35:21: error: 'mid' was not declared in this scope
   35 |                 l = mid;
      |                     ^~~
cave.cpp:38:21: error: 'mid' was not declared in this scope
   38 |                 r = mid;
      |                     ^~~