# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
118064 | 2019-06-18T05:58:02 Z | 김세빈(#2888) | Bitaro, who Leaps through Time (JOI19_timeleap) | C++14 | 3000 ms | 15000 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll L1[303030], L2[303030], R1[303030], R2[303030]; ll n; int main() { ll q, t, i, k, l, r, x, y, s, e; scanf("%lld%lld", &n, &q); for(i=1; i<n; i++){ scanf("%lld%lld", &l, &r); L1[i] = l - i; R1[i] = r - i - 1; L2[i + 1] = l + i + 1; R2[i + 1] = r + i; } for(; q--; ){ scanf("%lld", &t); if(t == 1){ scanf("%lld%lld%lld", &i, &l, &r); L1[i] = l - i; R1[i] = r - i - 1; L2[i + 1] = l + i + 1; R2[i + 1] = r + i; } else{ scanf("%lld%lld%lld%lld", &x, &s, &y, &e); k = 0; if(x <= y){ s -= x; e -= y; for(i=x; i<y; i++){ if(s < L1[i]) s = L1[i]; else if(s > R1[i]) k += s - R1[i], s = R1[i]; } if(s > e) k += s - e; } else{ s += x; e += y; for(i=x; i>y; i--){ if(s < L2[i]) s = L2[i]; else if(s > R2[i]) k += s - R2[i], s = R2[i]; } if(s > e) k += s - e; } printf("%lld\n", k); } } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 3 ms | 384 KB | Output is correct |
11 | Correct | 4 ms | 384 KB | Output is correct |
12 | Correct | 4 ms | 384 KB | Output is correct |
13 | Correct | 4 ms | 512 KB | Output is correct |
14 | Correct | 3 ms | 512 KB | Output is correct |
15 | Correct | 3 ms | 512 KB | Output is correct |
16 | Correct | 3 ms | 512 KB | Output is correct |
17 | Correct | 4 ms | 512 KB | Output is correct |
18 | Correct | 3 ms | 512 KB | Output is correct |
19 | Correct | 4 ms | 512 KB | Output is correct |
20 | Correct | 4 ms | 512 KB | Output is correct |
21 | Correct | 3 ms | 384 KB | Output is correct |
22 | Correct | 3 ms | 384 KB | Output is correct |
23 | Correct | 3 ms | 512 KB | Output is correct |
24 | Correct | 3 ms | 384 KB | Output is correct |
25 | Correct | 3 ms | 512 KB | Output is correct |
26 | Correct | 3 ms | 384 KB | Output is correct |
27 | Correct | 3 ms | 512 KB | Output is correct |
28 | Correct | 4 ms | 512 KB | Output is correct |
29 | Correct | 4 ms | 384 KB | Output is correct |
30 | Correct | 3 ms | 512 KB | Output is correct |
31 | Correct | 3 ms | 384 KB | Output is correct |
32 | Correct | 4 ms | 384 KB | Output is correct |
33 | Correct | 3 ms | 384 KB | Output is correct |
34 | Correct | 3 ms | 512 KB | Output is correct |
35 | Correct | 4 ms | 384 KB | Output is correct |
36 | Correct | 3 ms | 512 KB | Output is correct |
37 | Correct | 3 ms | 472 KB | Output is correct |
38 | Correct | 3 ms | 512 KB | Output is correct |
39 | Correct | 3 ms | 512 KB | Output is correct |
40 | Correct | 4 ms | 512 KB | Output is correct |
41 | Correct | 2 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3033 ms | 15000 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 3 ms | 384 KB | Output is correct |
11 | Correct | 4 ms | 384 KB | Output is correct |
12 | Correct | 4 ms | 384 KB | Output is correct |
13 | Correct | 4 ms | 512 KB | Output is correct |
14 | Correct | 3 ms | 512 KB | Output is correct |
15 | Correct | 3 ms | 512 KB | Output is correct |
16 | Correct | 3 ms | 512 KB | Output is correct |
17 | Correct | 4 ms | 512 KB | Output is correct |
18 | Correct | 3 ms | 512 KB | Output is correct |
19 | Correct | 4 ms | 512 KB | Output is correct |
20 | Correct | 4 ms | 512 KB | Output is correct |
21 | Correct | 3 ms | 384 KB | Output is correct |
22 | Correct | 3 ms | 384 KB | Output is correct |
23 | Correct | 3 ms | 512 KB | Output is correct |
24 | Correct | 3 ms | 384 KB | Output is correct |
25 | Correct | 3 ms | 512 KB | Output is correct |
26 | Correct | 3 ms | 384 KB | Output is correct |
27 | Correct | 3 ms | 512 KB | Output is correct |
28 | Correct | 4 ms | 512 KB | Output is correct |
29 | Correct | 4 ms | 384 KB | Output is correct |
30 | Correct | 3 ms | 512 KB | Output is correct |
31 | Correct | 3 ms | 384 KB | Output is correct |
32 | Correct | 4 ms | 384 KB | Output is correct |
33 | Correct | 3 ms | 384 KB | Output is correct |
34 | Correct | 3 ms | 512 KB | Output is correct |
35 | Correct | 4 ms | 384 KB | Output is correct |
36 | Correct | 3 ms | 512 KB | Output is correct |
37 | Correct | 3 ms | 472 KB | Output is correct |
38 | Correct | 3 ms | 512 KB | Output is correct |
39 | Correct | 3 ms | 512 KB | Output is correct |
40 | Correct | 4 ms | 512 KB | Output is correct |
41 | Correct | 2 ms | 384 KB | Output is correct |
42 | Execution timed out | 3033 ms | 15000 KB | Time limit exceeded |
43 | Halted | 0 ms | 0 KB | - |