Submission #986497

# Submission time Handle Problem Language Result Execution time Memory
986497 2024-05-20T16:45:30 Z boris_mihov Island Hopping (JOI24_island) C++17
Compilation error
0 ms 0 KB
#include "island.h"
#include <vector>

void solve(int n, int L) 
{
    std::vector <int> order(n);
    std::vector <bool> foundParent(n + 1, false);
    for (int i = 1 ; i < n ; ++i)
    {
        order[i] = ask(1, i);
    }   

    foundParent[1] = true;
    for (int i = 1 ; i < n ; ++i)
    {
        if (!foundParent[order[i]])
        {
            for (int idx = 1 ; idx < n ; ++idx)
            {
                int curr = ask(order[i], idx);
                answer(order[i], curr);
                if (foundParent[curr])
                {
                    foundParent[order[i]] = true;
                    break;
                }

                foundParent[curr] = true;
            }
        }
    }
}

Compilation message

island.cpp: In function 'void solve(int, int)':
island.cpp:10:20: error: 'ask' was not declared in this scope
   10 |         order[i] = ask(1, i);
      |                    ^~~
island.cpp:20:28: error: 'ask' was not declared in this scope
   20 |                 int curr = ask(order[i], idx);
      |                            ^~~