This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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){
assert(false);
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 {
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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |