# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
831187 | caganyanmaz | 수천개의 섬 (IOI22_islands) | C++17 | 34 ms | 8788 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define pb push_back
#include "islands.h"
using namespace std;
#ifdef DEBUGGING
#include "../debug.h"
#else
#define debug(x...) void(42)
#endif
constexpr static int MXN = 1e5 + 5;
int n, m;
vector<int> u, v;
vector<array<int, 2>> g[MXN];
int state[MXN];
vector<int> path;
bool dfs(int node)
{
state[node] = 1;
for (auto [c, e] : g[node])
{
path.pb(e);
if (state[c] == 1)
return true;
if (state[c] == 0 && dfs(c))
return true;
path.pop_back();
}
state[node] = 2;
return false;
}
variant<bool, vector<int>> find_journey(int N, int M, vector<int> U, vector<int> V)
{
n = N, m = M;
u = U, v = V;
for (int i = 0; i < m; i+=2)
g[u[i]].pb({v[i], i});
if(!dfs(0))
return false;
int lsn = v[path.back()];
vector<int> res;
int i;
for (i = path.size()-2; i >= 0 && v[path[i]] != lsn; i--);
for (int j = 0; j <= i; j++)
res.pb(path[j]);
for (int j = i+1; j < path.size(); j++)
res.pb(path[j]);
for (int j = i+1; j < path.size(); j++)
res.pb(path[j]+1);
for (int j = path.size()-1; j > i; j--)
res.pb(path[j]);
for (int j = path.size()-1; j > i; j--)
res.pb(path[j]+1);
for (int j = i; j >= 0; j--)
res.pb(path[j]);
return res;
}
컴파일 시 표준 에러 (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... |