Submission #1070367

#TimeUsernameProblemLanguageResultExecution timeMemory
1070367zsomborLongest Trip (IOI23_longesttrip)C++17
25 / 100
15 ms600 KiB
#include "longesttrip.h" #include <bits/stdc++.h> using namespace std; vector<int> longest_trip(int N, int D) { vector<int> a(1, 0); vector<int> b(1, 1); for (int i = 2; i < N; i++) { if (are_connected({a.back()}, {b.back()})) { while (b.size()) { a.push_back(b.back()); b.pop_back(); } b.push_back(i); continue; } if (are_connected({a.back()}, {i})) a.push_back(i); else b.push_back(i); } return (a.size() > b.size() ? a : b); }
#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...