# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
822928 | 2023-08-12T05:14:40 Z | mindiyak | Toy Train (IOI17_train) | C++14 | 2000 ms | 262144 KB |
#include "train.h" using namespace std; vector<vector<int>> paths(1e4,vector<int> ()); vector<int> chargers; // vector<int> cost(1e4,-1); int loop = 0; int n; void dfs(int pos,int start,int coins,int charging){ if(loop==1)return; if(chargers[pos] == 1){ charging = 1; coins = n; } if(pos==start and charging==1){loop = 1;} coins--; if(coins <= 0)return; for(int a:paths[pos]){ dfs(a,start,coins,charging); } } std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) { n=a.size(); chargers = a; for (int i = 0; i < u.size(); i++){ paths[u[i]].push_back(v[i]); } vector<int> ans(n,-1); for (int i = 0; i < u.size(); i++){ loop = 0; dfs(i,i,n,chargers[i]); ans[i] = loop; } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 120 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 108 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 2132 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2065 ms | 1268 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 117 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 120 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |