# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
222576 | 2020-04-13T11:10:18 Z | kingfran1907 | Segway (COI19_segway) | C++14 | 293 ms | 1404 KB |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e4+10; int n, m; int v[maxn][3]; int dis[maxn]; int ac[maxn]; bool flag[maxn]; vector< pair<int, int> > tren, cp; int main() { memset(flag, false, sizeof flag); scanf("%d", &n); for (int i = 0; i < n; i++) for (int j = 0; j < 3; j++) scanf("%d", &v[i][j]); scanf("%d", &m); for (int i = 0; i < m; i++) { int x; scanf("%d", &x); flag[x] = true; } for (int i = 0; i < n; i++) tren.push_back(make_pair(0, i)); for (int t = 0; t < 300; t++) { cp.clear(); int cnt = 0; int preftim = -1; for (int i = 0; i < n; i++) { int tim = tren[i].first; int ind = tren[i].second; if (tim != preftim) cnt = i; preftim = tim; if (flag[t] && ac[ind] == 0) ac[ind] = cnt % 20; if (ac[ind] > 0) { ac[ind]--; dis[ind]++; } else dis[ind] += v[ind][t / 100]; cp.push_back(make_pair(dis[ind], ind)); } tren = cp; sort(tren.begin(), tren.end()); } for (int i = 0; i < n; i++) printf("%d\n", dis[i]); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 6 ms | 384 KB | Output is correct |
3 | Correct | 13 ms | 384 KB | Output is correct |
4 | Correct | 47 ms | 512 KB | Output is correct |
5 | Correct | 293 ms | 1404 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 6 ms | 384 KB | Output is correct |
9 | Correct | 7 ms | 384 KB | Output is correct |
10 | Correct | 7 ms | 384 KB | Output is correct |
11 | Correct | 7 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 6 ms | 384 KB | Output is correct |
3 | Correct | 13 ms | 384 KB | Output is correct |
4 | Correct | 47 ms | 512 KB | Output is correct |
5 | Correct | 293 ms | 1404 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
12 | Correct | 5 ms | 384 KB | Output is correct |
13 | Correct | 6 ms | 384 KB | Output is correct |
14 | Correct | 7 ms | 384 KB | Output is correct |
15 | Correct | 7 ms | 384 KB | Output is correct |
16 | Correct | 7 ms | 384 KB | Output is correct |
17 | Correct | 16 ms | 452 KB | Output is correct |
18 | Correct | 27 ms | 504 KB | Output is correct |
19 | Correct | 138 ms | 916 KB | Output is correct |
20 | Correct | 184 ms | 1016 KB | Output is correct |
21 | Correct | 232 ms | 1272 KB | Output is correct |
22 | Correct | 291 ms | 1404 KB | Output is correct |
23 | Correct | 275 ms | 1404 KB | Output is correct |