# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1024794 | vjudge1 | 수천개의 섬 (IOI22_islands) | C++17 | 43 ms | 23116 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 used[maxn];
vector<int> cyc, ord, ver, pref;
int n, m;
void dfs(int v){
used[v] = 1;
ver.push_back(v);
for(int to:g[v]){
if(used[to] == 1){
cyc = ord;
pref.clear();
cyc.push_back(a[v][to]);
for(int i=0;i<ver.size();i++){
if(ver[i] == to){
break;
}
pref.push_back(cyc[i]);
}
}
if(!used[to]){
ord.push_back(a[v][to]);
dfs(to);
ord.pop_back();
}
}
used[v] = 2;
ver.pop_back();
}
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+=2){
a[u[i]][v[i]] = i;
g[u[i]].push_back(v[i]);
}
dfs(0);
if(cyc.size() == 0){
return false;
}
vector<int> ans = pref;
reverse(cyc.begin(), cyc.end());
for(int i=0;i<pref.size() && cyc.size();i++){
cyc.pop_back();
}
reverse(cyc.begin(), cyc.end());
for(int x:cyc){
ans.push_back(x);
}
for(int x:cyc){
ans.push_back(x+1);
}
reverse(cyc.begin(), cyc.end());
for(int x:cyc){
ans.push_back(x);
}
for(int x:cyc){
ans.push_back(x+1);
}
reverse(pref.begin(), pref.end());
for(int x:pref){
ans.push_back(x);
}
return ans;
}
컴파일 시 표준 에러 (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... |