# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
422125 | Antekb | 장난감 기차 (IOI17_train) | C++14 | 384 ms | 99336 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "train.h"
#include<bits/stdc++.h>
#define st first
#define nd second
#define pb(x) push_back(x)
using namespace std;
const int N=5005;
vector<int> E[N], rE[N];
int d[N];
int wsk=0;
int czy[N][N], dobre[N];
int vis[N];
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> uu, std::vector<int> vv) {
int n=a.size(), m=uu.size();
std::vector<int> res(n);
for(int i=0; i<m; i++){
//cout<<uu[i]<<" "<<vv[i]<<"\n";
E[uu[i]].pb(vv[i]);
rE[vv[i]].pb(uu[i]);
}
for(int i=0; i<n; i++){
if(r[i]){
for(int j=0; j<n; j++)d[j]=E[j].size(), vis[j]=0;
vector<int> V;
V.push_back(i);
for(int j=0; j<V.size(); j++){
//cout<<i<<" "<<V[j]<<"\n";
if(j)czy[V[j]][i]=1;
if(V[j]==i && j!=0)continue;
int v=V[j];
for(int u:rE[v]){
if(a[u] && !vis[u]){
vis[u]=1;
V.pb(u);
}
if(!a[u] && --d[u]==0){
V.pb(u);
}
//assert(d[u]>=0);
}
}
}
}
/*int c=0;
for(int i=0; i<n; i++)if(r[i])c=i;
//cout<<c<<"\n";
for(int i=0; i<n;i++){
res[i]=czy[i][c]*czy[c][c];
}*/
/*for(int i=0; i<n; i++){
if(r[i]){
for(int j=0;j<n; j++){
if(czy[i][j] && czy[j][i])dobre[i]=1;
}
}
}
for(int i=0; i<n ;i++){
for(int j=0; j<n; j++){
if(czy[i][j] && czy[j][j])res[i]=1;
}
}*/
for(int i=n-1; i>=0; i--){
if((!a[i]) && r[i]){
//cout<<i<<"c\n";
if(E[i].size()==2 || E[i][0]==i+1)res[i]=res[i+1];
else res[i]=1;
}
else if(a[i] && r[i]){
if(E[i].size()==2 || E[i][0]==i)res[i]=1;
else res[i]=res[i+1];
//cout<<i<<"b\n";
}
else if(!a[i] && !r[i]){
if(E[i].size()==2 || E[i][0]==i)res[i]=0;
else res[i]=res[i+1];
}
else if(a[i] && !r[i]){
if(E[i].size()==2 || E[i][0]==i+1)res[i]=res[i+1];
else res[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... |