제출 #1037619

#제출 시각아이디문제언어결과실행 시간메모리
1037619thinknoexit수천개의 섬 (IOI22_islands)C++17
컴파일 에러
0 ms0 KiB
#include "islands.h" #include <bits/stdc++.h> using namespace std; using ll = long long; variant<bool, vector<int>> find_journey(int N, int M, vector<int> U, vector<int> V) { if (N == 2) { vector<vector<int>> boat(2); for (int i = 0;i < M;i++) boat[U[i]].push_back(i); if ((int)boat[0].size() < 2 || (int)boat[1].size() < 1) return false; vector<int> ans = { boat[0][0], boat[1][0], boat[0][1], boat[0][0], boat[1][0], boat[0][1] }; return ans; } vector<vector<int>> boat(n, vector<int>(n, 0)); for (int i = 0;i < M;i++) { boat[U[i]][V[i]] = i; } vector<int> ans = { boat[0][1], boat[1][0], boat[0][2], boat[2][1], boat[0][1], boat[1][0], boat[2][1], boat[0][2] }; return ans; }

컴파일 시 표준 에러 (stderr) 메시지

islands.cpp: In function 'std::variant<bool, std::vector<int, std::allocator<int> > > find_journey(int, int, std::vector<int>, std::vector<int>)':
islands.cpp:14:30: error: 'n' was not declared in this scope
   14 |     vector<vector<int>> boat(n, vector<int>(n, 0));
      |                              ^