Submission #842486

#TimeUsernameProblemLanguageResultExecution timeMemory
842486CodePlatinaLongest Trip (IOI23_longesttrip)C++17
Compilation error
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; }

Compilation message (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);
      |                                                          ^