Submission #117716

#TimeUsernameProblemLanguageResultExecution timeMemory
117716PlurmToy Train (IOI17_train)C++14
0 / 100
268 ms262144 KiB
#include "train.h" #include <bits/stdc++.h> using namespace std; vector<int> g[5005]; bool loop[5005]; bool rech[5005]; bool dfs(int u){ if(g[u].empty()) return loop[u] && rech[u]; for(int x : g[u]) if(dfs(x)) return true; return loop[u] && rech[u]; } vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) { // Subtask 1 int m = u.size(); for(int i = 0; i < m; i++){ if(u[i] == v[i]) loop[u[i]] = true; else g[u[i]].push_back(v[i]); } int n = a.size(); for(int i = 0; i < n; i++){ rech[i] = r[i]; } vector<int> res; for(int i = 0; i < n; i++){ res.push_back(dfs(i)); } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...