Submission #1070340

#TimeUsernameProblemLanguageResultExecution timeMemory
1070340zsomborLongest Trip (IOI23_longesttrip)C++17
15 / 100
7 ms436 KiB
#include "longesttrip.h" #include <bits/stdc++.h> using namespace std; vector<int> longest_trip(int N, int D) { bool b01=are_connected({0},{1}); bool b02=are_connected({0},{2}); vector <int> v; if (!b01) v={0,2,1}; if (!b02) v={0,1,2}; if (b01 && b02) v={1,0,2}; deque<int> d; for (int i : v) d.push_back(i); for (int i=3;i<N;i++) { int a=d.front(),b=d.back(); if (are_connected({a},{i})) d.push_front(i); else d.push_back(i); } v.clear(); while (d.size()) { v.push_back(d.front()); d.pop_front(); } return v; }

Compilation message (stderr)

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:15:25: warning: unused variable 'b' [-Wunused-variable]
   15 |         int a=d.front(),b=d.back();
      |                         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...