Submission #1327793

#TimeUsernameProblemLanguageResultExecution timeMemory
1327793lucasdmyCave (IOI13_cave)C++20
Compilation error
0 ms0 KiB
//#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
void exploreCave(int n){
    vector<int>state(n, -1), resp(n, -1);
    for(int k=0;k<n;k++){
        int p1=0, p2=n-1, my_state=0;
        vector<int>query(n);
        for(int i=0;i<n;i++){
            if(state[i]!=-1){
                query[i]=state[i];
            }else{
                state[i]=0;
            }
        }
        int aux=tryCombination(query);
        if(aux==k){
            my_state=1;
        }
        while(p1!=p2){
            int m=(p1+p2)/2;
            for(int i=0;i<n;i++){
                if(state[i]!=-1){
                    query[i]=state[i];
                }else if(p1<=i and i<=m){
                    state[i]=my_state;
                }else{
                    state[i]=(my_state+1)%2;
                }
            }
            if(tryCombination(query)==k){
                p1=m+1;
            }else{
                p2=m;
            }
        }
        state[p2]=my_state;
        resp[p2]=k;
    }
    answer(state, resp);
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:16:17: error: 'tryCombination' was not declared in this scope
   16 |         int aux=tryCombination(query);
      |                 ^~~~~~~~~~~~~~
cave.cpp:40:5: error: 'answer' was not declared in this scope
   40 |     answer(state, resp);
      |     ^~~~~~