# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
65513 |
2018-08-07T19:51:49 Z |
gs13068 |
Toy Train (IOI17_train) |
C++17 |
|
2000 ms |
1596 KB |
#include <vector>
using namespace std;
int d[2][5005], s[5005];
vector<int> g[5005];
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
int i, j, n = a.size(), m = u.size();
int *p = d[0], *q = d[1], *t;
for (i = 0; i < m; i++) g[u[i]].push_back(v[i]);
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
if (a[j]) {
q[j] = 0;
for (auto t : g[j]) if (p[t] > q[j]) q[j] = p[t];
}
else {
q[j] = 1e9;
for (auto t : g[j]) if (p[t] < q[j]) q[j] = p[t];
}
if (r[j]) q[j]++;
}
t = p; p = q; q = t;
}
for (i = 0; i < n; i++) s[i] = p[i];
for (i = 0; i < n + n; i++) {
for (j = 0; j < n; j++) {
if (a[j]) {
q[j] = 0;
for (auto t : g[j]) if (p[t] > q[j]) q[j] = p[t];
}
else {
q[j] = 1e9;
for (auto t : g[j]) if (p[t] < q[j]) q[j] = p[t];
}
if (r[j]) q[j]++;
}
t = p; p = q; q = t;
}
vector<int> ans;
for (i = 0; i < n; i++) ans.push_back(p[i] > s[i]);
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1197 ms |
964 KB |
Output is correct |
2 |
Correct |
1255 ms |
996 KB |
Output is correct |
3 |
Correct |
1221 ms |
1012 KB |
Output is correct |
4 |
Correct |
1159 ms |
1032 KB |
Output is correct |
5 |
Correct |
1154 ms |
1052 KB |
Output is correct |
6 |
Correct |
1187 ms |
1052 KB |
Output is correct |
7 |
Correct |
872 ms |
1076 KB |
Output is correct |
8 |
Correct |
950 ms |
1076 KB |
Output is correct |
9 |
Correct |
1185 ms |
1096 KB |
Output is correct |
10 |
Correct |
1166 ms |
1096 KB |
Output is correct |
11 |
Correct |
1047 ms |
1236 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
1236 KB |
Output is correct |
2 |
Correct |
2 ms |
1236 KB |
Output is correct |
3 |
Correct |
2 ms |
1236 KB |
Output is correct |
4 |
Correct |
2 ms |
1236 KB |
Output is correct |
5 |
Correct |
4 ms |
1236 KB |
Output is correct |
6 |
Correct |
3 ms |
1236 KB |
Output is correct |
7 |
Correct |
2 ms |
1236 KB |
Output is correct |
8 |
Correct |
2 ms |
1236 KB |
Output is correct |
9 |
Correct |
2 ms |
1236 KB |
Output is correct |
10 |
Correct |
2 ms |
1236 KB |
Output is correct |
11 |
Correct |
2 ms |
1236 KB |
Output is correct |
12 |
Correct |
2 ms |
1236 KB |
Output is correct |
13 |
Correct |
3 ms |
1236 KB |
Output is correct |
14 |
Correct |
3 ms |
1236 KB |
Output is correct |
15 |
Correct |
2 ms |
1236 KB |
Output is correct |
16 |
Correct |
2 ms |
1236 KB |
Output is correct |
17 |
Correct |
3 ms |
1236 KB |
Output is correct |
18 |
Correct |
2 ms |
1236 KB |
Output is correct |
19 |
Correct |
2 ms |
1236 KB |
Output is correct |
20 |
Correct |
2 ms |
1236 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
823 ms |
1596 KB |
Output is correct |
2 |
Correct |
982 ms |
1596 KB |
Output is correct |
3 |
Correct |
941 ms |
1596 KB |
Output is correct |
4 |
Execution timed out |
2074 ms |
1596 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1626 ms |
1596 KB |
Output is correct |
2 |
Correct |
1607 ms |
1596 KB |
Output is correct |
3 |
Correct |
1700 ms |
1596 KB |
Output is correct |
4 |
Execution timed out |
2069 ms |
1596 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2073 ms |
1596 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1197 ms |
964 KB |
Output is correct |
2 |
Correct |
1255 ms |
996 KB |
Output is correct |
3 |
Correct |
1221 ms |
1012 KB |
Output is correct |
4 |
Correct |
1159 ms |
1032 KB |
Output is correct |
5 |
Correct |
1154 ms |
1052 KB |
Output is correct |
6 |
Correct |
1187 ms |
1052 KB |
Output is correct |
7 |
Correct |
872 ms |
1076 KB |
Output is correct |
8 |
Correct |
950 ms |
1076 KB |
Output is correct |
9 |
Correct |
1185 ms |
1096 KB |
Output is correct |
10 |
Correct |
1166 ms |
1096 KB |
Output is correct |
11 |
Correct |
1047 ms |
1236 KB |
Output is correct |
12 |
Correct |
3 ms |
1236 KB |
Output is correct |
13 |
Correct |
2 ms |
1236 KB |
Output is correct |
14 |
Correct |
2 ms |
1236 KB |
Output is correct |
15 |
Correct |
2 ms |
1236 KB |
Output is correct |
16 |
Correct |
4 ms |
1236 KB |
Output is correct |
17 |
Correct |
3 ms |
1236 KB |
Output is correct |
18 |
Correct |
2 ms |
1236 KB |
Output is correct |
19 |
Correct |
2 ms |
1236 KB |
Output is correct |
20 |
Correct |
2 ms |
1236 KB |
Output is correct |
21 |
Correct |
2 ms |
1236 KB |
Output is correct |
22 |
Correct |
2 ms |
1236 KB |
Output is correct |
23 |
Correct |
2 ms |
1236 KB |
Output is correct |
24 |
Correct |
3 ms |
1236 KB |
Output is correct |
25 |
Correct |
3 ms |
1236 KB |
Output is correct |
26 |
Correct |
2 ms |
1236 KB |
Output is correct |
27 |
Correct |
2 ms |
1236 KB |
Output is correct |
28 |
Correct |
3 ms |
1236 KB |
Output is correct |
29 |
Correct |
2 ms |
1236 KB |
Output is correct |
30 |
Correct |
2 ms |
1236 KB |
Output is correct |
31 |
Correct |
2 ms |
1236 KB |
Output is correct |
32 |
Correct |
823 ms |
1596 KB |
Output is correct |
33 |
Correct |
982 ms |
1596 KB |
Output is correct |
34 |
Correct |
941 ms |
1596 KB |
Output is correct |
35 |
Execution timed out |
2074 ms |
1596 KB |
Time limit exceeded |
36 |
Halted |
0 ms |
0 KB |
- |