제출 #1263237

#제출 시각아이디문제언어결과실행 시간메모리
1263237blueviolet동굴 (IOI13_cave)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;



int s[5009], d[5009];
set<int> st;

void exploreCave(int N) {
    st.clear();
    for (int i = 0; i < N; i++) {
        s[i] = 0;
        d[i] = 0;
        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);
}

컴파일 시 표준 에러 (stderr) 메시지

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:18:27: error: 'tryCombination' was not declared in this scope
   18 |         int firstClosed = tryCombination(s);
      |                           ^~~~~~~~~~~~~~
cave.cpp:41:5: error: 'answer' was not declared in this scope
   41 |     answer(s, d);
      |     ^~~~~~