Submission #1274925

#TimeUsernameProblemLanguageResultExecution timeMemory
1274925muhammad-ahmadIsland Hopping (JOI24_island)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "island.h" void solve(int N, int L) { int cur = 1, F[N + 1] = {}, Ex[N + 1] = {}; bool vis[N]; map<pair<int, int>> C; vis[1] = 1; for (int i = 1; i <= N; i++){ int f = query(cur, 1); int ex = query(cur, 2); if (vis[f]){ if (!C[{cur, f}] && !C[{f, cur}]){ answer(cur, f); C[{cur, f}] = 1; } if (!C[{cur, ex}] && !C[{ex, cur}]){ answer(cur, ex); C[{cur, ex}] = 1; } vis[ex] = 1; vis[f] = 1; cur = x; } else { if (!C[{cur, f}] && !C[{f, cur}]){ answer(cur, f); C[{cur, f}] = 1; } vis[f] = 1; cur = ex; } } }

Compilation message (stderr)

island.cpp: In function 'void solve(int, int)':
island.cpp:8:9: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    8 |     map<pair<int, int>> C;
      |         ^~~~
      |         std::pair
In file included from /usr/include/c++/13/bits/stl_algobase.h:64,
                 from /usr/include/c++/13/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from island.cpp:1:
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
  187 |     struct pair
      |            ^~~~
island.cpp:8:5: error: 'map' was not declared in this scope
    8 |     map<pair<int, int>> C;
      |     ^~~
island.cpp:8:5: note: suggested alternatives:
In file included from /usr/include/c++/13/map:63,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:152:
/usr/include/c++/13/bits/stl_map.h:102:11: note:   'std::map'
  102 |     class map
      |           ^~~
/usr/include/c++/13/map:80:13: note:   'std::pmr::map'
   80 |       using map
      |             ^~~
island.cpp:8:14: error: expected primary-expression before 'int'
    8 |     map<pair<int, int>> C;
      |              ^~~
island.cpp:17:22: error: 'C' was not declared in this scope
   17 |                 if (!C[{cur, f}] && !C[{f, cur}]){
      |                      ^
island.cpp:21:22: error: 'C' was not declared in this scope
   21 |                 if (!C[{cur, ex}] && !C[{ex, cur}]){
      |                      ^
island.cpp:27:23: error: 'x' was not declared in this scope; did you mean 'ex'?
   27 |                 cur = x;
      |                       ^
      |                       ex
island.cpp:31:22: error: 'C' was not declared in this scope
   31 |                 if (!C[{cur, f}] && !C[{f, cur}]){
      |                      ^