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 <bits/stdc++.h>
#include <variant>
#include <vector>
using namespace std;
std::variant<bool, std::vector<int>> find_journey(int N, int M, std::vector<int> v1, std::vector<int> v2)
{
int n=N,m=M;
map<pair<int,int>,vector<int>> cnt;
for(int j=0;j<m;j++)
cnt[{v1[j],v2[j]}].push_back(j);
if(n>2)
{
int edge01=cnt[{0,1}][0];
int edge10=cnt[{1,0}][0];
int edge02=cnt[{0,2}][0];
int edge20=cnt[{2,0}][0];
int edge12=cnt[{1,2}][0];
int edge21=cnt[{2,1}][0];
return vector<int>({edge01,edge12,edge20,edge02,edge21,edge10,edge20,edge12,edge01,edge10,edge21,edge02});
}
else if(cnt[{0,1}].size()>=2 and cnt[{1,0}].size()>=1)
{
int f=cnt[{0,1}][0];
int s=cnt[{0,1}][1];
int th=cnt[{1,0}][0];
return vector<int>({f,th,s,f,th,s});
}
else
{
return false;
}
}
# | 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... |