답안 #959948

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
959948 2024-04-09T11:06:04 Z hqminhuwu 동굴 (IOI13_cave) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <ll,ll> pll;
typedef pair <int,int> pii;
typedef pair <int,pii> piii;

#define forr(_a,_b,_c) for(int _a = (_b); _a <= (_c); ++_a)
#define ford(_a,_b,_c) for(int _a = (_b) + 1; _a --> (_c);)
#define forf(_a,_b,_c) for(int _a = (_b); _a < (_c); ++_a)
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define all(x) begin(x),end(x)
#define mask(i) (1LL << (i))
#define bit(x, i) (((x) >> (i)) & 1)
#define bp __builtin_popcountll
#define file "test"

const int maxn = 5e5 + 5;
const ll oo = 1e9;
const ll mod = 1e9 + 7; // 998244353;

int flag[maxn], state[maxn], a[maxn], n, ansS[maxn], ansD[maxn];

void solve (int x){
    forr (i, 1, n){
        if (flag[i] != -1)
            a[i] = state[i];
        else a[i] = 0;
    }

    int f = tryCombination(a);
    int u = (f < x);

    int l = 1, r = n - 1;
    while (l < r){
        int mid = (l + r) >> 1;
        forr (i, l, r)
        if (flag[i] == -1)
            a[i] = (i > mid) ^ u;
        if (tryCombination(a) < x){
            forr (i, l, r)
            if (flag[i] == -1)
                a[i] = (i <= mid) ^ u;
            l = mid + 1;
        } 
        else r = mid - 1;
    }

    state[l] = u;
    flag[l] = x;
}

void exploreCave (int num){
    n = num;
    memset (flag, -1, sizeof flag);

    forf (i, 0, n)
        solve(i);
    forf (i, 0, n){
        ansS[flag[i]] = state[i];
        ansD[flag[i]] = i;
    }
    answer(ansS, ansD);
}

Compilation message

cave.cpp: In function 'void solve(int)':
cave.cpp:35:13: error: 'tryCombination' was not declared in this scope
   35 |     int f = tryCombination(a);
      |             ^~~~~~~~~~~~~~
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:67:5: error: 'answer' was not declared in this scope
   67 |     answer(ansS, ansD);
      |     ^~~~~~