Submission #647935

#TimeUsernameProblemLanguageResultExecution timeMemory
647935TrashCoder007Cave (IOI13_cave)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;


void exploreCave(int n)
{
    int a[n];
    int id [n];
    for (int i = 0; i < n; i++) id[i] = -1;
    
    for (int i = 0; i < n; i++){
        int val = tryCombination(a);
        
        int k = 0; //abierta con 0
        if (val == i) k = 1; //abierta con 1
        
        int ini = 0, fin = n;
        while(ini < fin){
            int pos [n];
            int m = (ini + fin) / 2;
            for (int j = 0; j < n; j++){
                if (j >= ini && j <= m && id[j] == -1){
                    pos[j] = 1 - k;
                }else if (id[j] != -1){
                    pos[j] = a[j];
                }else{
                    pos[j] = k;
                }
            }
            
            int res = tryCombination(pos);
            if ((res == ini && k) || (res != ini && !k)){
                ini = m + 1;
            }else{
                fin = m;
            }
        }
        id[ini - 1] = i;
        a[ini - 1] = k;
    }
    answer(a, id);
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:12:19: error: 'tryCombination' was not declared in this scope
   12 |         int val = tryCombination(a);
      |                   ^~~~~~~~~~~~~~
cave.cpp:41:5: error: 'answer' was not declared in this scope
   41 |     answer(a, id);
      |     ^~~~~~