# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
126751 | neki | 장난감 기차 (IOI17_train) | C++14 | 2051 ms | 1668 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "train.h"
#include <bits/stdc++.h>
#define maxn 5010
#define loop(i, a, b) for(int i=a;i<b;i++)
#define cc(a) cout<< a << endl;
using namespace std;
vector<int> edges[maxn];
vector<int> owner;vector<int> power;
int low[maxn];
int bval[maxn];
int cnt=0;
bool dfs(int u){
low[u]=cnt; if(power[u]) cnt++;
bval[u]=0;
bool ans=(!(owner[u]));
for(auto&& e:edges[u]){
bool cmp;
if(bval[e]==-1) dfs(e);
if(low[e]!=-1 and( low[e]!=low[u] or power[u])) cmp=1;
else{ cmp=bval[e];}
if(owner[u]) ans=ans or cmp;
else ans=ans and cmp;
}
bval[u]=ans;
low[u]=-1;
return ans;
}
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
int n=a.size();
std::vector<int> res(n);
loop(i, 0, u.size()) edges[u[i]].push_back(v[i]);
owner=a;power=r;
loop(i, 0, n){
loop(j, 0, n) {low[j]=-1;bval[j]=-1;}
res[i]=dfs(i);
}
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... |