# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
483292 | 2021-10-28T14:24:33 Z | rainboy | Specijacija (COCI20_specijacija) | C | 4000 ms | 4816 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_ = (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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 26 ms | 4044 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 26 ms | 4044 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 26 ms | 4044 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4082 ms | 4816 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |