Submission #887103

#TimeUsernameProblemLanguageResultExecution timeMemory
887103Username_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+1; return out; } if(D==2){ int pnt=1; out[0]=1; while(pnt<N){ int a [1] = {pnt}; int b [1] = {pnt+1}; bool connect = are_connected{a,b}; if(connect){ out[pnt]=pnt+1; pnt++; } else{ out[pnt]=pnt+2; out[pnt+1]=pnt+1; pnt++; pnt++; } } return out; } if(D==1){ return out; } return out; }

Compilation message (stderr)

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:24:16: warning: the address of 'bool are_connected(std::vector<int>, std::vector<int>)' will never be NULL [-Waddress]
   24 | bool connect = are_connected{a,b};
      |                ^~~~~~~~~~~~~
longesttrip.cpp:24:29: error: expected ',' or ';' before '{' token
   24 | bool connect = are_connected{a,b};
      |                             ^
longesttrip.cpp:22:5: warning: unused variable 'a' [-Wunused-variable]
   22 | int a [1] = {pnt};
      |     ^
longesttrip.cpp:23:5: warning: unused variable 'b' [-Wunused-variable]
   23 | int b [1] = {pnt+1};
      |     ^