# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
747023 | danikoynov | 장난감 기차 (IOI17_train) | C++14 | 1398 ms | 1404 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 5010;
int n, m, a[maxn], r[maxn], cycle[maxn], nxt[maxn];
vector < int > g[maxn];
int tf, used[maxn];
void dfs(int v)
{
used[v] = 1;
for (int u : g[v])
{
if (!used[u])
{
dfs(u);
if (cycle[u])
cycle[v] = 1;
}
else
{
if (used[u] == 1)
{
cycle[v] = 1;
}
}
}
used[v] = 2;
}
vector<int> who_wins(vector<int> A, vector<int> R, vector<int> U, vector<int> V)
{
n = A.size();
m = U.size();
for (int i = 0; i < n; i ++)
a[i] = A[i];
for (int i = 0; i < n; i ++)
r[i] = R[i];
for (int i = 0; i < m; i ++)
{
g[U[i]].push_back(V[i]);
}
vector < int > res(n);
for (int i = 0; i < n; i ++)
{
for (int j = 0; j < n; j ++)
used[j] = 0, cycle[j] = 0;
dfs(i);
for (int j = 0; j < n; j ++)
if (cycle[j] && r[j])
res[i] = 1;
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |