# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
371289 | 2021-02-26T12:04:11 Z | KoD | Toy Train (IOI17_train) | C++17 | 2000 ms | 876 KB |
#include <bits/stdc++.h> #include "train.h" template <class T> using Vec = std::vector<T>; Vec<int> who_wins(Vec<int> a, Vec<int> r, Vec<int> u, Vec<int> v) { const int n = (int) a.size(); const int m = (int) u.size(); { bool sub1 = true; Vec<bool> loop(n); Vec<bool> right(n); for (int i = 0; i < m; ++i) { if (u[i] != v[i]) { loop[u[i]] = true; } else if (u[i] + 1 == v[i]) { right[u[i]] = true; } else { sub1 = false; break; } } if (sub1) { Vec<int> ret(n); for (int i = n - 1; i >= 0; --i) { if (a[i]) { ret[i] = 0; if (r[i] && loop[i]) { ret[i] = 1; } if (right[i] && ret[i + 1]) { ret[i] = 1; } } else { ret[i] = 1; if (!r[i] && loop[i]) { ret[i] = 0; } if (right[i] && !ret[i + 1]) { ret[i] = 0; } } } return ret; } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2082 ms | 620 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2080 ms | 384 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2092 ms | 876 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2071 ms | 748 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2039 ms | 876 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2082 ms | 620 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |