Submission #986496

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

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:5:10: error: 'vector' is not a member of 'std'
    5 |     std::vector <int> order(n);
      |          ^~~~~~
island.cpp:2:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
    1 | #include "island.h"
  +++ |+#include <vector>
    2 | 
island.cpp:5:18: error: expected primary-expression before 'int'
    5 |     std::vector <int> order(n);
      |                  ^~~
island.cpp:6:10: error: 'vector' is not a member of 'std'
    6 |     std::vector <bool> foundParent(n + 1, false);
      |          ^~~~~~
island.cpp:6:10: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
island.cpp:6:18: error: expected primary-expression before 'bool'
    6 |     std::vector <bool> foundParent(n + 1, false);
      |                  ^~~~
island.cpp:9:9: error: 'order' was not declared in this scope
    9 |         order[i] = ask(1, i);
      |         ^~~~~
island.cpp:9:20: error: 'ask' was not declared in this scope
    9 |         order[i] = ask(1, i);
      |                    ^~~
island.cpp:12:5: error: 'foundParent' was not declared in this scope
   12 |     foundParent[1] = true;
      |     ^~~~~~~~~~~
island.cpp:15:26: error: 'order' was not declared in this scope
   15 |         if (!foundParent[order[i]])
      |                          ^~~~~
island.cpp:19:28: error: 'ask' was not declared in this scope
   19 |                 int curr = ask(order[i], idx);
      |                            ^~~