Submission #887118

#TimeUsernameProblemLanguageResultExecution timeMemory
887118Username_taken12Longest Trip (IOI23_longesttrip)C++17
Compilation error
0 ms0 KiB
#include "longesttrip.h" #include <bits/stdc++.h> using namespace std; vector<int> longest_trip(int N, int D){ vector<int> out; for(int i=0; i<N; i++) out.push_back(0); if(D==3){ for(int i=0; i<N; i++) out[i]=i; return out; } if(D==2){ int pnt=1; out[0]=0; while(pnt<N){ vector<int> a; a.push_back(pnt-1); vector<int> b; b.push_back(pnt); bool connect = are_connected(a,b); if(connect){ out[pnt]=pnt; pnt++; } else if(pnt==N-1){ out[pnt]=pnt+1; out[pnt+1]=pnt; pnt++; pnt++; } else{ out.pop_back(); out.push_front(N-1); pnt++ } } return out; } if(D==1){ return out; } return out; } /*int main() { vector<int> a; a=longest_trip(5, 3); for(int i=0; i<5; i++) cout<<a[i]<<" "; }*/

Compilation message (stderr)

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:37:5: error: 'class std::vector<int>' has no member named 'push_front'
   37 | out.push_front(N-1);
      |     ^~~~~~~~~~
longesttrip.cpp:39:6: error: expected ';' before '}' token
   39 | pnt++
      |      ^
      |      ;
   40 | }
      | ~