# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
422903 | schse | Toy Train (IOI17_train) | C++17 | 1845 ms | 1416 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "train.h"
#ifndef EVAL
#include "grader.cpp"
#endif
#define DEACTIVATED -1
#define UNKNOWN 0
#include <bits/stdc++.h>
using namespace std;
struct node
{
vector<int> edges;
bool been;
bool actice;
int chargingsationsbefore = INT32_MAX;
bool charging = false;
bool owner;
bool winningpos = false;
};
vector<node> g;
int dfs(int n, int charging)
{
if (g[n].actice && g[n].chargingsationsbefore < charging)
return true;
else if (g[n].been)
return false;
g[n].been = true;
g[n].actice = true;
g[n].chargingsationsbefore = charging;
if (g[n].charging)
charging++;
bool b = false;
for (int i : g[n].edges)
{
b |= dfs(i, charging);
}
g[n].actice = false;
return b;
}
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v)
{
g.resize(a.size());
for (int i = 0; i < a.size(); i++)
{
g[i].owner = a[i];
g[i].charging = r[i];
}
for (int i = 0; i < u.size(); i++)
{
g[u[i]].edges.push_back(v[i]);
}
vector<int> res(a.size(), 0);
for (int i = 0; i < (int)a.size(); i++)
{
for (int i = 0; i < a.size(); i++)
g[i].been = false;
res[i] = dfs(i, 0);
}
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... |