Submission #1058391

#TimeUsernameProblemLanguageResultExecution timeMemory
1058391tolbiThousands Islands (IOI22_islands)C++17
0 / 100
1 ms860 KiB
#include "islands.h" #include <bits/stdc++.h> using namespace std; std::variant<bool, std::vector<int>> find_journey( int N, int M, std::vector<int> U, std::vector<int> V) { vector<vector<pair<int,int>>> arr(N); for (int i = 0; i < M; i++){ arr[U[i]].push_back({V[i],i}); } for (int i = 0; i < N; ++i) { sort(arr[i].begin(), arr[i].end()); } if (arr[0].size()<=1) return false; int a = arr[0][0].first; int b = arr[0][1].first; if (a==b){ return vector<int>{arr[0][0].second,arr[a][0].second,arr[0][1].second,arr[0][0].second,arr[a][0].second,arr[0][1].second}; } else { assert(false); return vector<int>{arr[0][0].second,arr[a][0].second,arr[0][1].second,arr[b][0].second,arr[a][0].second,arr[0][0].second,arr[b][0].second,arr[0][1].second}; } }
#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...