# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
628532 | Sorting | Thousands Islands (IOI22_islands) | C++17 | 1090 ms | 5148 KiB |
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 <variant>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
std::variant<bool, std::vector<int>> find_journey(
int n, int m, std::vector<int> u, std::vector<int> v) {
if(n == 2){
vector<int> cnt[2]{};
for(int i = 0; i < u.size();++i){
cnt[u[i]].push_back(i);
}
if(cnt[0].size() >= 2 && cnt[1].size() >= 1){
return vector<int>{cnt[0][0], cnt[1][0], cnt[0][1], cnt[0][0], cnt[1][0], cnt[0][1]};
}
return false;
}
vector<vector<pair<int, int>>> adj(n);
for(int i = 0; i < m; ++i)
adj[u[i]].push_back({v[i], i});
int x = 0, par = -1;
while(true){
if(adj[x].size() != 1){
if(adj[x].size() < 1){
return false;
}
return true;
}
x = adj[x][0].first;
}
}
Compilation message (stderr)
# | 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... |