Submission #1263238

#TimeUsernameProblemLanguageResultExecution timeMemory
1263238bluevioletCave (IOI13_cave)C++20
Compilation error
0 ms0 KiB
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;

void exploreCave(int N) {
    vector<int> s(N, 0), d(N, 0);
    set<int> st;

    for (int i = 0; i < N; i++) st.insert(i);

    while (true) {
        int firstClosed = tryCombination(s);
        if (firstClosed == -1) break;

        for (auto it = st.begin(); it != st.end();) {
            int pos = *it;
            s[pos] ^= 1;
            int pp = tryCombination(s);
            if (pp == -1) break;

            if (pp < firstClosed) {
                s[pos] ^= 1;
                d[pos] = pp;
                it = st.erase(it);
            } else if (pp > firstClosed) {
                d[pos] = firstClosed;
                it = st.erase(it);
                break;
            } else {
                s[pos] ^= 1;
                ++it;
            }
        }
    }
    answer(s, d);
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:12:42: error: cannot convert 'std::vector<int>' to 'int*'
   12 |         int firstClosed = tryCombination(s);
      |                                          ^
      |                                          |
      |                                          std::vector<int>
In file included from cave.cpp:1:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:18:37: error: cannot convert 'std::vector<int>' to 'int*'
   18 |             int pp = tryCombination(s);
      |                                     ^
      |                                     |
      |                                     std::vector<int>
In file included from cave.cpp:1:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:35:12: error: cannot convert 'std::vector<int>' to 'int*'
   35 |     answer(s, d);
      |            ^
      |            |
      |            std::vector<int>
In file included from cave.cpp:1:
cave.h:9:17: note:   initializing argument 1 of 'void answer(int*, int*)'
    9 | void answer(int S[], int D[]);
      |             ~~~~^~~