제출 #1310690

#제출 시각아이디문제언어결과실행 시간메모리
1310690theiulius동굴 (IOI13_cave)C++20
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define pb push_back
// #include "graderlib.c"
// #include "cave.h"
int t = 1;
int n = 0;

// void answer(int a[], int b[]){
//     for (int i = 0; i < n; i++){
//         cout << a[i] << " ";
//     }
//     cout << endl;
//     for (int i = 0; i < n; i++){
//         cout << b[i] << " ";
//     }
//     cout << endl;
// }

// int tryCombination(int s[]){
//     for (int i = 0; i < n; i++){
//         cout << s[i] << " ";
//     }
//     cout << endl;
//     int x;
//     cin >> x;
//     return x;
// }

void exploreCave(int N) {
    n = N;
    int a[n] = {}, b[n] = {};
    for (int i = 0; i < n; i++){ // doors
        int x = tryCombination(a);
        if (x > i || x == -1){ // gagebulia i
            a[i] = 0;
        }else{
            a[i] = 1; // kari 1-ze igeba
        }
        
        int l = i, r = n - 1, ans = i;
        while (l <= r){
            int mid = (l + r) / 2;
            for (int j = i; j <= mid; j++){
                a[j] = b[i];
            }
            for (int j = mid + 1; j < n; j++){
                a[j] = 1 ^ b[i];
            }
            x = tryCombination(a);
            
            if (x > i || x == -1){
                r = mid - 1;
                ans = mid;
            }else{
                l = mid + 1;
            }
        }
        
        b[ans] = i;
    }
    
    answer(a, b);
}

// main(){
//     exploreCave(4);
// }

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

cave.cpp: In function 'void exploreCave(long long int)':
cave.cpp:37:17: error: 'tryCombination' was not declared in this scope
   37 |         int x = tryCombination(a);
      |                 ^~~~~~~~~~~~~~
cave.cpp:66:5: error: 'answer' was not declared in this scope
   66 |     answer(a, b);
      |     ^~~~~~