# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
593788 | FatihSolak | Toy Train (IOI17_train) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "train.h"
#include <bits/stdc++.h>
#define N 5005
using namespace std;
int path[N][N];
bool special[N];
vector<int> adj[N];
void dfs(int v,int num){
vis[num][v] = 1;
for(auto u:adj[v])[
if(!vis[nun][u]){
dfs(u,num);
}
]
}
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
int n = a.size();
int m = u.size();
for(int i=0;i<m;i++){
ad[u].push_back(v);
}
for(int i = 0;i<n;i++){
dfs(i,i);
}
for(int i = 0;i<n;i++){
if(r[i]){
for(auto u:adj[i]){
if(path[u][v]){
special[i] = 1;
}
}
}
}
vector<int> res(n);
for(int i = 0; i < n; i++){
for(int j = 0;j<n;j++){
if(special[j] && path[i][j]){
res[i] = 1;
}
}
}
return res;
}