# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
104973 | 2019-04-10T03:26:14 Z | Just_Solve_The_Problem | Bitaro, who Leaps through Time (JOI19_timeleap) | C++11 | 3000 ms | 7944 KB |
#include <bits/stdc++.h> using namespace std; const int N = (int)3e5 + 7; int n, q; int L[N], R[N]; main() { scanf("%d %d", &n, &q); for (int i = 1; i < n; i++) { scanf("%d %d", &L[i], &R[i]); } while (q--) { int tp; scanf("%d", &tp); if (tp == 1) { int ind, l, r; scanf("%d %d %d", &ind, &l, &r); L[ind] = l; R[ind] = r; } else { int a, b, c, d; scanf("%d %d %d %d", &a, &b, &c, &d); int ans = 0; if (a < c) { int cur = b; for (int i = a; i < c; i++) { if (L[i] <= cur && cur + 1 <= R[i]) { cur++; } else { if (cur < L[i]) cur = L[i] + 1; else { ans += (cur - R[i] + 1); cur = R[i]; } } } if (cur > d) { ans += (cur - d); } } else { int cur = b; for (int i = a - 1; i >= c; i--) { if (L[i] <= cur && cur + 1 <= R[i]) { cur++; } else { if (cur < L[i]) cur = L[i] + 1; else { ans += (cur - R[i] + 1); cur = R[i]; } } } if (cur > d) { ans += (cur - d); } } printf("%d\n", ans); } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | 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 | 3 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 3 ms | 256 KB | Output is correct |
8 | Correct | 2 ms | 256 KB | Output is correct |
9 | Correct | 2 ms | 256 KB | Output is correct |
10 | Correct | 2 ms | 256 KB | Output is correct |
11 | Incorrect | 4 ms | 384 KB | Output isn't correct |
12 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3005 ms | 7944 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | 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 | 3 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 3 ms | 256 KB | Output is correct |
8 | Correct | 2 ms | 256 KB | Output is correct |
9 | Correct | 2 ms | 256 KB | Output is correct |
10 | Correct | 2 ms | 256 KB | Output is correct |
11 | Incorrect | 4 ms | 384 KB | Output isn't correct |
12 | Halted | 0 ms | 0 KB | - |