Submission #724224

#TimeUsernameProblemLanguageResultExecution timeMemory
724224BobonbushCave (IOI13_cave)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MODULO = 1e9+7;
const ll INF = 1e18+1;
template<class X ,class Y>
    bool Minimize(X &x , Y y)
    {
        if(x > y)
        {
            x = y ;
            return true;
        }
        return false;
    }
template<class X ,class Y>
    bool Maximize(X &x , Y y )
    {
        if(x < y)
        {
            x = y;
            return true;
        }
        return false;
    }
template<class X ,class Y>
    void Add(X &x , Y y)
    {
        x += y;
        if( x >= MODULO) x -= MODULO;
    }
template<class X ,class Y>
    void Sub(X &x , Y y )
    {
        x -= y ;
        if( x < 0 ) x += MODULO;
    }

void ExploreCave(int n)
{
    int status[n] ;
    int related[n];
    for(int i = 0 ; i < n ; i++)
    {
        related[i] = 0;
        status[i] = 0;
    }
    vector<int>List;
    for(int i = 0 ; i < n ; i++)List.push_back(i);
    for(int i = 0 ; i < n ; i++)
    {
        int cur = tryCombination(status);
        int l = 0;
        int r = (int)List.size()-1;
        int best = -1;
        int trangthai = -1;
        while(l <= r)
        {
            int mid = (l+r) >> 1;
            for(int i = 0 ; i < mid ; i++)
            {
                status[List[i]] = 1;
            }
            int x = tryCombination(status);
            for(int i = 0 ; i < mid ;i++)status[List[i]] = 0;
            if(x != cur)
            {
                trangthai = x;
                best = mid;
                r = mid-1;
                continue;
            }
            l = mid+1;
        }
        assert(best == -1);
        int t = List[best];
        status[t] = 1;
        swap(List[best] , List.back());
        List.pop_back();
        if(cur == -1)
        {
            status[t] = 0;
            related[best] = trangthai;
        }else
        {
            status[t] = 1;
            related[best] = cur;
        }
    }

    answer(status , related);
}

Compilation message (stderr)

cave.cpp: In function 'void ExploreCave(int)':
cave.cpp:52:19: error: 'tryCombination' was not declared in this scope
   52 |         int cur = tryCombination(status);
      |                   ^~~~~~~~~~~~~~
cave.cpp:91:5: error: 'answer' was not declared in this scope
   91 |     answer(status , related);
      |     ^~~~~~