Submission #846512

#TimeUsernameProblemLanguageResultExecution timeMemory
846512Trisanu_DasLongest Trip (IOI23_longesttrip)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #include "longesttrip.h" vector<int> longest_trip(int N, int D){ vector<int> ans; int u = 0; ans.push_back(u); while(u < n - 1){ if(are_connected({u}, {u + 1})) ans.push_back(++u); else if(u != n - 2){ ans.push_back(u + 1); ans.push_back(u + 2); u += 2; }else{ reverse(ans.begin(), ans.end()); ans.push_back(n - 1); u++; } } return ans; }

Compilation message (stderr)

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:8:13: error: 'n' was not declared in this scope
    8 |   while(u < n - 1){
      |             ^