제출 #837133

#제출 시각아이디문제언어결과실행 시간메모리
837133kebine동굴 (IOI13_cave)C++17
컴파일 에러
0 ms0 KiB
#include "cave.h"
// #include "graderlib.c"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second

int a[MAX_N], b[MAX_N], input;
bool check[MAX_N];

void exploreCave(int N) {
    int cnt = 0;
    while (cnt < N) {
        for (int i = 0; i < N; i++) if (!check[i]) a[i] = 0;
        input = tryCombination(a);
        int id;
        if (input == -1 or input > cnt) id = 0;
        else id = 1;
        int l = 0, r = N - 1;
        while (l < r) {
            int len = 0, cnt2 = 0, m = -1;
            for (int i = 0; i < N; i++) if (!check[i]) a[i] = 1 - id;
            for (int i = l; i <= r; i++) if (!check[i]) len++;
            for (int i = l; i <= r; i++) {
                if (check[i]) continue;
                cnt2++;
                m = i;
                a[i] = id;
                if (cnt2 == len / 2) break;
            }
            if (len == 1) {
                l = m;
                break;
            }
            input = tryCombination(a);
            if (input == -1 or input > cnt) r = m;
            else l = m + 1;
        }
        check[l] = 1, a[l] = id, b[l] = cnt;
        cnt++;
    }
    answer(a, b);
}

// int main() {
//     int N;
//     N = init();
//     exploreCave(N);
//     printf("INCORRECT\nYour solution did not call answer().\n");
//     return 0;
// }


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

cave.cpp:13:7: error: 'MAX_N' was not declared in this scope
   13 | int a[MAX_N], b[MAX_N], input;
      |       ^~~~~
cave.cpp:13:17: error: 'MAX_N' was not declared in this scope
   13 | int a[MAX_N], b[MAX_N], input;
      |                 ^~~~~
cave.cpp:14:12: error: 'MAX_N' was not declared in this scope
   14 | bool check[MAX_N];
      |            ^~~~~
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:19:42: error: 'check' was not declared in this scope
   19 |         for (int i = 0; i < N; i++) if (!check[i]) a[i] = 0;
      |                                          ^~~~~
cave.cpp:19:52: error: 'a' was not declared in this scope
   19 |         for (int i = 0; i < N; i++) if (!check[i]) a[i] = 0;
      |                                                    ^
cave.cpp:20:32: error: 'a' was not declared in this scope
   20 |         input = tryCombination(a);
      |                                ^
cave.cpp:27:46: error: 'check' was not declared in this scope
   27 |             for (int i = 0; i < N; i++) if (!check[i]) a[i] = 1 - id;
      |                                              ^~~~~
cave.cpp:28:47: error: 'check' was not declared in this scope
   28 |             for (int i = l; i <= r; i++) if (!check[i]) len++;
      |                                               ^~~~~
cave.cpp:30:21: error: 'check' was not declared in this scope
   30 |                 if (check[i]) continue;
      |                     ^~~~~
cave.cpp:44:9: error: 'check' was not declared in this scope
   44 |         check[l] = 1, a[l] = id, b[l] = cnt;
      |         ^~~~~
cave.cpp:44:34: error: 'b' was not declared in this scope
   44 |         check[l] = 1, a[l] = id, b[l] = cnt;
      |                                  ^
cave.cpp:47:12: error: 'a' was not declared in this scope
   47 |     answer(a, b);
      |            ^
cave.cpp:47:15: error: 'b' was not declared in this scope
   47 |     answer(a, b);
      |               ^