Submission #1312200

#TimeUsernameProblemLanguageResultExecution timeMemory
1312200orgiloogiiCave (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:6:13: error: 'n' was not declared in this scope
    6 |     int res[n];
      |             ^
cave.cpp:9:9: error: 'state' was not declared in this scope; did you mean '_xstate'?
    9 |         state[i] = -1;
      |         ^~~~~
      |         _xstate
cave.cpp:10:9: error: 'res' was not declared in this scope
   10 |         res[i] = -1;
      |         ^~~
cave.cpp:16:17: error: 'state' was not declared in this scope; did you mean 'onstate'?
   16 |             if (state[i] == -1) temp[i] = 0;
      |                 ^~~~~
      |                 onstate
cave.cpp:16:33: error: 'temp' was not declared in this scope; did you mean 'tm'?
   16 |             if (state[i] == -1) temp[i] = 0;
      |                                 ^~~~
      |                                 tm
cave.cpp:17:18: error: 'temp' was not declared in this scope; did you mean 'tm'?
   17 |             else temp[i] = state[i];
      |                  ^~~~
      |                  tm
cave.cpp:19:36: error: 'temp' was not declared in this scope; did you mean 'tm'?
   19 |         int block = tryCombination(temp);
      |                                    ^~~~
      |                                    tm
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:30:21: error: 'state' was not declared in this scope; did you mean 'onstate'?
   30 |                 if (state[i] == -1) temp[i] = onstate;
      |                     ^~~~~
      |                     onstate
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;
      |                     ^~~
cave.cpp:41:9: error: 'state' was not declared in this scope; did you mean 'onstate'?
   41 |         state[l] = onstate;
      |         ^~~~~
      |         onstate
cave.cpp:42:9: error: 'res' was not declared in this scope
   42 |         res[i] = l;
      |         ^~~
cave.cpp:44:12: error: 'state' was not declared in this scope; did you mean '_xstate'?
   44 |     answer(state, res);
      |            ^~~~~
      |            _xstate
cave.cpp:44:19: error: 'res' was not declared in this scope
   44 |     answer(state, res);
      |                   ^~~