# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
483293 | 2021-10-28T14:27:54 Z | rainboy | Specijacija (COCI20_specijacija) | C | 4000 ms | 4292 KB |
#include <stdio.h> #define N 200000 int depth(long long i) { int d = 0; while ((long long) (d + 1) * (d + 2) / 2 <= i) d++; return d; } int main() { static long long ii[N]; int n, q, t, i; long long n_, ans; scanf("%d%d%d", &n, &q, &t); for (i = 0; i < n; i++) scanf("%lld", &ii[i]), ii[i]--, ii[i] -= (long long) i * (i + 1) / 2; n_ = (long long) (n + 1) * (n + 2) / 2, ans = 0; while (q--) { long long i, j; int di, dj; scanf("%lld%lld", &i, &j), i--, j--; i = (i + t * ans) % n_, j = (j + t * ans) % n_; di = depth(i), i -= (long long) di * (di + 1) / 2; dj = depth(j), j -= (long long) dj * (dj + 1) / 2; while (di != dj || i != j) if (di > dj) { if (i > ii[--di]) i--; } else { if (j > ii[--dj]) j--; } printf("%lld\n", ans = (long long) di * (di + 1) / 2 + i + 1); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 25 ms | 1812 KB | Output is correct |
2 | Correct | 2 ms | 460 KB | Output is correct |
3 | Correct | 26 ms | 3952 KB | Output is correct |
4 | Correct | 15 ms | 2124 KB | Output is correct |
5 | Correct | 26 ms | 3968 KB | Output is correct |
6 | Correct | 9 ms | 1368 KB | Output is correct |
7 | Correct | 26 ms | 3952 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 25 ms | 1812 KB | Output is correct |
2 | Correct | 2 ms | 460 KB | Output is correct |
3 | Correct | 26 ms | 3952 KB | Output is correct |
4 | Correct | 15 ms | 2124 KB | Output is correct |
5 | Correct | 26 ms | 3968 KB | Output is correct |
6 | Correct | 9 ms | 1368 KB | Output is correct |
7 | Correct | 26 ms | 3952 KB | Output is correct |
8 | Correct | 1112 ms | 3412 KB | Output is correct |
9 | Correct | 552 ms | 3124 KB | Output is correct |
10 | Correct | 1097 ms | 3592 KB | Output is correct |
11 | Correct | 155 ms | 2500 KB | Output is correct |
12 | Correct | 1104 ms | 3472 KB | Output is correct |
13 | Correct | 266 ms | 2880 KB | Output is correct |
14 | Correct | 555 ms | 3952 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 25 ms | 1812 KB | Output is correct |
2 | Correct | 2 ms | 460 KB | Output is correct |
3 | Correct | 26 ms | 3952 KB | Output is correct |
4 | Correct | 15 ms | 2124 KB | Output is correct |
5 | Correct | 26 ms | 3968 KB | Output is correct |
6 | Correct | 9 ms | 1368 KB | Output is correct |
7 | Correct | 26 ms | 3952 KB | Output is correct |
8 | Correct | 1112 ms | 3412 KB | Output is correct |
9 | Correct | 552 ms | 3124 KB | Output is correct |
10 | Correct | 1097 ms | 3592 KB | Output is correct |
11 | Correct | 155 ms | 2500 KB | Output is correct |
12 | Correct | 1104 ms | 3472 KB | Output is correct |
13 | Correct | 266 ms | 2880 KB | Output is correct |
14 | Correct | 555 ms | 3952 KB | Output is correct |
15 | Execution timed out | 4078 ms | 4292 KB | Time limit exceeded |
16 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4057 ms | 1824 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |