# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
104760 | 2019-04-09T07:18:55 Z | mzhao | Bitaro, who Leaps through Time (JOI19_timeleap) | C++11 | 3000 ms | 8728 KB |
#include <bits/stdc++.h> using namespace std; #ifdef DEBUG #define D(x...) printf(x) #else #define D(x...) #endif #define MN 300009 #define ll long long int N, Q, L[MN], R[MN]; int main() { scanf("%d%d", &N, &Q); for (int i = 1; i < N; i++) { scanf("%d%d", &L[i], &R[i]); } for (int _ = 0, T, A, B, C, D; _ < Q; _++) { scanf("%d", &T); if (T == 1) { scanf("%d%d%d", &A, &B, &C); L[A] = B; R[A] = C; } else { scanf("%d%d%d%d", &A, &B, &C, &D); ll cur = 0; if (A <= C) { for (int i = A; i < C; i++) { B = max(B, L[i]); if (B >= R[i]) { cur += B-R[i]+1; B = R[i]-1; } B++; } if (B > D) cur += B-D; } else { for (int i = A-1; i >= C; i--) { B = max(B, L[i]); if (B >= R[i]) { cur += B-R[i]+1; B = R[i]-1; } B++; } if (B > D) cur += B-D; } printf("%lld\n", cur); } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
2 | Correct | 3 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 | 3 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 3 ms | 384 KB | Output is correct |
8 | Correct | 3 ms | 384 KB | Output is correct |
9 | Correct | 3 ms | 384 KB | Output is correct |
10 | Correct | 3 ms | 256 KB | Output is correct |
11 | Correct | 5 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 | 4 ms | 384 KB | Output is correct |
15 | Correct | 4 ms | 384 KB | Output is correct |
16 | Correct | 2 ms | 384 KB | Output is correct |
17 | Correct | 5 ms | 432 KB | Output is correct |
18 | Correct | 5 ms | 384 KB | Output is correct |
19 | Correct | 4 ms | 384 KB | Output is correct |
20 | Correct | 3 ms | 384 KB | Output is correct |
21 | Correct | 5 ms | 384 KB | Output is correct |
22 | Correct | 4 ms | 384 KB | Output is correct |
23 | Correct | 4 ms | 384 KB | Output is correct |
24 | Correct | 4 ms | 384 KB | Output is correct |
25 | Correct | 4 ms | 384 KB | Output is correct |
26 | Correct | 3 ms | 384 KB | Output is correct |
27 | Correct | 4 ms | 384 KB | Output is correct |
28 | Correct | 4 ms | 384 KB | Output is correct |
29 | Correct | 4 ms | 472 KB | Output is correct |
30 | Correct | 5 ms | 384 KB | Output is correct |
31 | Correct | 6 ms | 384 KB | Output is correct |
32 | Correct | 4 ms | 384 KB | Output is correct |
33 | Correct | 4 ms | 384 KB | Output is correct |
34 | Correct | 4 ms | 384 KB | Output is correct |
35 | Correct | 5 ms | 384 KB | Output is correct |
36 | Correct | 5 ms | 384 KB | Output is correct |
37 | Correct | 4 ms | 384 KB | Output is correct |
38 | Correct | 5 ms | 384 KB | Output is correct |
39 | Correct | 3 ms | 488 KB | Output is correct |
40 | Correct | 3 ms | 384 KB | Output is correct |
41 | Correct | 2 ms | 428 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3068 ms | 8728 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
2 | Correct | 3 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 | 3 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 3 ms | 384 KB | Output is correct |
8 | Correct | 3 ms | 384 KB | Output is correct |
9 | Correct | 3 ms | 384 KB | Output is correct |
10 | Correct | 3 ms | 256 KB | Output is correct |
11 | Correct | 5 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 | 4 ms | 384 KB | Output is correct |
15 | Correct | 4 ms | 384 KB | Output is correct |
16 | Correct | 2 ms | 384 KB | Output is correct |
17 | Correct | 5 ms | 432 KB | Output is correct |
18 | Correct | 5 ms | 384 KB | Output is correct |
19 | Correct | 4 ms | 384 KB | Output is correct |
20 | Correct | 3 ms | 384 KB | Output is correct |
21 | Correct | 5 ms | 384 KB | Output is correct |
22 | Correct | 4 ms | 384 KB | Output is correct |
23 | Correct | 4 ms | 384 KB | Output is correct |
24 | Correct | 4 ms | 384 KB | Output is correct |
25 | Correct | 4 ms | 384 KB | Output is correct |
26 | Correct | 3 ms | 384 KB | Output is correct |
27 | Correct | 4 ms | 384 KB | Output is correct |
28 | Correct | 4 ms | 384 KB | Output is correct |
29 | Correct | 4 ms | 472 KB | Output is correct |
30 | Correct | 5 ms | 384 KB | Output is correct |
31 | Correct | 6 ms | 384 KB | Output is correct |
32 | Correct | 4 ms | 384 KB | Output is correct |
33 | Correct | 4 ms | 384 KB | Output is correct |
34 | Correct | 4 ms | 384 KB | Output is correct |
35 | Correct | 5 ms | 384 KB | Output is correct |
36 | Correct | 5 ms | 384 KB | Output is correct |
37 | Correct | 4 ms | 384 KB | Output is correct |
38 | Correct | 5 ms | 384 KB | Output is correct |
39 | Correct | 3 ms | 488 KB | Output is correct |
40 | Correct | 3 ms | 384 KB | Output is correct |
41 | Correct | 2 ms | 428 KB | Output is correct |
42 | Execution timed out | 3068 ms | 8728 KB | Time limit exceeded |
43 | Halted | 0 ms | 0 KB | - |