Submission #380625

#TimeUsernameProblemLanguageResultExecution timeMemory
380625vishesh312Cave (IOI13_cave)C++17
Compilation error
0 ms0 KiB
#include "bits/stdc++.h"
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
*/

#define all(x) begin(x), end(x)
#define sz(x) (int)x.size()

using ll = long long;
const int mod = 1e9+7;

void exploreCave(int n) {
    int s[n], d[n];
    vector<bool> avl(n, true);
    for (int i = 0; i < n; ++i) {
        s[i] = 0;
        d[i] = -1;
    }
    for (int i = 0; i < n; ++i) {
        int x = tryCombination(s);
        bool zero = (x > i or x == -1);
        int str = 0;
        for (int jump = (n+1)/2; jump >= 1; jump++, jump /= 2) {
            int temp[] = s;
            for (int j = str; j < str+jump; ++j) {
                if (avl[j]) {
                    temp[j] = !zero;
                }
            }
            x = tryCombination(temp);
            if (x > i or x == -1) {
                if (jump == 1) {
                    d[i] = str;
                    s[str] = !zero;
                    break;
                } else {
                    continue;
                }
            } else {
                str += jump;
            }
        }
    }
    answer(s, d);
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:23:17: error: 'tryCombination' was not declared in this scope
   23 |         int x = tryCombination(s);
      |                 ^~~~~~~~~~~~~~
cave.cpp:27:26: error: initializer fails to determine size of 'temp'
   27 |             int temp[] = s;
      |                          ^
cave.cpp:27:26: error: array must be initialized with a brace-enclosed initializer
cave.cpp:47:5: error: 'answer' was not declared in this scope
   47 |     answer(s, d);
      |     ^~~~~~