# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
169411 | 2019-12-20T09:08:26 Z | AngusRitossa | New Home (APIO18_new_home) | C++14 | 5000 ms | 14036 KB |
#include <bits/stdc++.h> using namespace std; int n, k, q; int x[300010], t[300010], a[300010], b[300010]; int closestoftype[300010]; int main() { scanf("%d%d%d", &n, &k, &q); for (int i = 0; i < n; i++) { scanf("%d%d%d%d", &x[i], &t[i], &a[i], &b[i]); } for (int i = 0; i < q; i++) { int l, y; scanf("%d%d", &l, &y); fill_n(closestoftype, k+1, 1e9); for (int j = 0; j < n; j++) { if (a[j] <= y && y <= b[j]) { closestoftype[t[j]] = min(closestoftype[t[j]], abs(l-x[j])); } } int ans = 0; for (int i = 1; i <= k; i++) ans = max(ans, closestoftype[i]); if (ans == 1e9) printf("-1\n"); else printf("%d\n", ans); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 504 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 3 ms | 376 KB | Output is correct |
6 | Correct | 4 ms | 504 KB | Output is correct |
7 | Correct | 4 ms | 376 KB | Output is correct |
8 | Correct | 3 ms | 376 KB | Output is correct |
9 | Correct | 4 ms | 376 KB | Output is correct |
10 | Correct | 3 ms | 376 KB | Output is correct |
11 | Correct | 3 ms | 376 KB | Output is correct |
12 | Correct | 3 ms | 380 KB | Output is correct |
13 | Correct | 2 ms | 380 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 3 ms | 376 KB | Output is correct |
16 | Correct | 4 ms | 376 KB | Output is correct |
17 | Correct | 3 ms | 404 KB | Output is correct |
18 | Correct | 3 ms | 376 KB | Output is correct |
19 | Correct | 3 ms | 376 KB | Output is correct |
20 | Correct | 3 ms | 376 KB | Output is correct |
21 | Correct | 3 ms | 376 KB | Output is correct |
22 | Correct | 3 ms | 376 KB | Output is correct |
23 | Correct | 3 ms | 376 KB | Output is correct |
24 | Correct | 3 ms | 376 KB | Output is correct |
25 | Correct | 3 ms | 376 KB | Output is correct |
26 | Correct | 3 ms | 376 KB | Output is correct |
27 | Correct | 3 ms | 376 KB | Output is correct |
28 | Correct | 2 ms | 376 KB | Output is correct |
29 | Correct | 3 ms | 376 KB | Output is correct |
30 | Correct | 3 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 504 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 3 ms | 376 KB | Output is correct |
6 | Correct | 4 ms | 504 KB | Output is correct |
7 | Correct | 4 ms | 376 KB | Output is correct |
8 | Correct | 3 ms | 376 KB | Output is correct |
9 | Correct | 4 ms | 376 KB | Output is correct |
10 | Correct | 3 ms | 376 KB | Output is correct |
11 | Correct | 3 ms | 376 KB | Output is correct |
12 | Correct | 3 ms | 380 KB | Output is correct |
13 | Correct | 2 ms | 380 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 3 ms | 376 KB | Output is correct |
16 | Correct | 4 ms | 376 KB | Output is correct |
17 | Correct | 3 ms | 404 KB | Output is correct |
18 | Correct | 3 ms | 376 KB | Output is correct |
19 | Correct | 3 ms | 376 KB | Output is correct |
20 | Correct | 3 ms | 376 KB | Output is correct |
21 | Correct | 3 ms | 376 KB | Output is correct |
22 | Correct | 3 ms | 376 KB | Output is correct |
23 | Correct | 3 ms | 376 KB | Output is correct |
24 | Correct | 3 ms | 376 KB | Output is correct |
25 | Correct | 3 ms | 376 KB | Output is correct |
26 | Correct | 3 ms | 376 KB | Output is correct |
27 | Correct | 3 ms | 376 KB | Output is correct |
28 | Correct | 2 ms | 376 KB | Output is correct |
29 | Correct | 3 ms | 376 KB | Output is correct |
30 | Correct | 3 ms | 376 KB | Output is correct |
31 | Execution timed out | 5092 ms | 4204 KB | Time limit exceeded |
32 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 5088 ms | 14036 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 5005 ms | 13160 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 504 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 3 ms | 376 KB | Output is correct |
6 | Correct | 4 ms | 504 KB | Output is correct |
7 | Correct | 4 ms | 376 KB | Output is correct |
8 | Correct | 3 ms | 376 KB | Output is correct |
9 | Correct | 4 ms | 376 KB | Output is correct |
10 | Correct | 3 ms | 376 KB | Output is correct |
11 | Correct | 3 ms | 376 KB | Output is correct |
12 | Correct | 3 ms | 380 KB | Output is correct |
13 | Correct | 2 ms | 380 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 3 ms | 376 KB | Output is correct |
16 | Correct | 4 ms | 376 KB | Output is correct |
17 | Correct | 3 ms | 404 KB | Output is correct |
18 | Correct | 3 ms | 376 KB | Output is correct |
19 | Correct | 3 ms | 376 KB | Output is correct |
20 | Correct | 3 ms | 376 KB | Output is correct |
21 | Correct | 3 ms | 376 KB | Output is correct |
22 | Correct | 3 ms | 376 KB | Output is correct |
23 | Correct | 3 ms | 376 KB | Output is correct |
24 | Correct | 3 ms | 376 KB | Output is correct |
25 | Correct | 3 ms | 376 KB | Output is correct |
26 | Correct | 3 ms | 376 KB | Output is correct |
27 | Correct | 3 ms | 376 KB | Output is correct |
28 | Correct | 2 ms | 376 KB | Output is correct |
29 | Correct | 3 ms | 376 KB | Output is correct |
30 | Correct | 3 ms | 376 KB | Output is correct |
31 | Execution timed out | 5092 ms | 4204 KB | Time limit exceeded |
32 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 504 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 3 ms | 376 KB | Output is correct |
6 | Correct | 4 ms | 504 KB | Output is correct |
7 | Correct | 4 ms | 376 KB | Output is correct |
8 | Correct | 3 ms | 376 KB | Output is correct |
9 | Correct | 4 ms | 376 KB | Output is correct |
10 | Correct | 3 ms | 376 KB | Output is correct |
11 | Correct | 3 ms | 376 KB | Output is correct |
12 | Correct | 3 ms | 380 KB | Output is correct |
13 | Correct | 2 ms | 380 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 3 ms | 376 KB | Output is correct |
16 | Correct | 4 ms | 376 KB | Output is correct |
17 | Correct | 3 ms | 404 KB | Output is correct |
18 | Correct | 3 ms | 376 KB | Output is correct |
19 | Correct | 3 ms | 376 KB | Output is correct |
20 | Correct | 3 ms | 376 KB | Output is correct |
21 | Correct | 3 ms | 376 KB | Output is correct |
22 | Correct | 3 ms | 376 KB | Output is correct |
23 | Correct | 3 ms | 376 KB | Output is correct |
24 | Correct | 3 ms | 376 KB | Output is correct |
25 | Correct | 3 ms | 376 KB | Output is correct |
26 | Correct | 3 ms | 376 KB | Output is correct |
27 | Correct | 3 ms | 376 KB | Output is correct |
28 | Correct | 2 ms | 376 KB | Output is correct |
29 | Correct | 3 ms | 376 KB | Output is correct |
30 | Correct | 3 ms | 376 KB | Output is correct |
31 | Execution timed out | 5092 ms | 4204 KB | Time limit exceeded |
32 | Halted | 0 ms | 0 KB | - |