# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1024699 | Wansur | 수천개의 섬 (IOI22_islands) | C++17 | 80 ms | 26300 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 <bits/stdc++.h>
#include <variant>
#define f first
#define s second
#define ent '\n'
using namespace std;
typedef long long ll;
const int maxn = 2e5 + 12;
const int mod = 1e9 + 2022;
map<int, int> a[maxn];
vector<int> g[maxn];
int n, m;
variant<bool, vector<int>> find_journey(int N, int M, vector<int> u, vector<int> v){
n = N, m = M;
for(int i=0;i<m;i++){
a[u[i]][v[i]] = i;
g[u[i]].push_back(i);
}
vector<int> ans;
if(g[0].size() >= 2){
int x = v[g[0][0]], y = v[g[0][1]];
ans = {a[0][x], a[x][0], a[0][y], a[y][0], a[x][0], a[0][x], a[y][0], a[0][y]};
return ans;
}
if(g[0].size() == 0) return false;
int x = v[g[0][0]], sz = 1, y = 0;
ans = {g[0][0]};
while(g[x].size() == 2){
int t = 0;
if(v[g[x][t]] == y){
t++;
}
ans.push_back(g[x][t]);
y = x;
x = v[g[x][t]];
}
if(g[x].size() <= 1) return false;
return ans;
}
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... |