제출 #842486

#제출 시각아이디문제언어결과실행 시간메모리
842486CodePlatina가장 긴 여행 (IOI23_longesttrip)C++17
컴파일 에러
0 ms0 KiB
#include "longesttrip.h" #include <iostream> #include <algorithm> #define pii pair<int, int> #define ff first #define ss second using namespace std; vector<int> longest_trip(int N, int d) { bool chc[N]{}; vector<pii> V; for(int i = 0; i < N; ++i) { for(int j = i + 1; j < N; ++j) { if(!are_connected(vector<int>{i}, vector<int>{j})) chc[i] = true, chc[j] = true, V.push_back({i, j}); } } vector<int> ret; for(auto [x, y] : V) ret.push_back(x); for(int i = 0; i < N; ++i) if(!chc[i]) ret.push_back(x); for(auto [x, y] : V) ret.push_back(y); return ret; }

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

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:24:58: error: 'x' was not declared in this scope
   24 |     for(int i = 0; i < N; ++i) if(!chc[i]) ret.push_back(x);
      |                                                          ^