Submission #1274985

#TimeUsernameProblemLanguageResultExecution timeMemory
1274985muhammad-ahmadIsland Hopping (JOI24_island)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "island.h" using namespace std; void solve(int n, int l) { map<int, map<int, bool>> P; map<pair<int, int>, int> C; for (int i = 1; i <= n; i++){ int f = query(i, 1), ex = query(i, 2); if (!C[{f, i}]){ C[{f, i}] = 1; C[{i, f}] = 1; answer(i, f); } if (!C[{f, ex}] && !C[{i, ex]}){ P[f][ex] = 1; P[i][ex] = 1; } } for (int i = 1; i <= n; i++){ for (auto [j, c] : P[i]){ if (!C[{i, j}] && P[j][i]){ answer(i, j); C[{i, j}] = 1; C[{j, i}] = 1; } } } }

Compilation message (stderr)

island.cpp: In function 'void solve(int, int)':
island.cpp:16:45: error: expected '}' before ']' token
   16 |                 if (!C[{f, ex}] && !C[{i, ex]}){
      |                                       ~     ^
island.cpp:16:46: error: expected ')' before '}' token
   16 |                 if (!C[{f, ex}] && !C[{i, ex]}){
      |                    ~                         ^
      |                                              )
island.cpp:16:46: error: expected primary-expression before '}' token
island.cpp:16:47: error: expected primary-expression before ')' token
   16 |                 if (!C[{f, ex}] && !C[{i, ex]}){
      |                                               ^
island.cpp: At global scope:
island.cpp:21:9: error: expected unqualified-id before 'for'
   21 |         for (int i = 1; i <= n; i++){
      |         ^~~
island.cpp:21:25: error: 'i' does not name a type
   21 |         for (int i = 1; i <= n; i++){
      |                         ^
island.cpp:21:33: error: 'i' does not name a type
   21 |         for (int i = 1; i <= n; i++){
      |                                 ^
island.cpp:30:1: error: expected declaration before '}' token
   30 | }
      | ^