# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
110140 | 2019-05-09T14:31:50 Z | IOrtroiii | Worst Reporter 3 (JOI18_worst_reporter3) | C++14 | 687 ms | 27504 KB |
#include <bits/stdc++.h> using namespace std; const int N = 500500; int d[N]; long long a[N]; int main() { int n, q; scanf("%d %d", &n, &q); a[0] = 1; for (int i = 1; i <= n; ++i) { scanf("%d", d + i); a[i] = (a[i - 1] - 1 + d[i]) / a[i - 1] * a[i - 1]; } int l = 0; vector< pair<int, int> > segs; while (l <= n) { int r = l; while (r < n && a[l] == a[r + 1]) r++; segs.push_back({l, r}); l = r + 1; } while (q--) { int t, l, r; scanf("%d %d %d", &t, &l, &r); int ans = 0; for (auto p : segs) { int l0 = p.second, r0 = p.first; int nw = t / a[l0] * a[l0]; l0 = max(-l0, l - nw), r0 = min(-r0, r - nw); ans += max(0, r0 - l0 + 1); } printf("%d\n", ans); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 394 ms | 24760 KB | Output is correct |
2 | Correct | 319 ms | 24696 KB | Output is correct |
3 | Correct | 352 ms | 24824 KB | Output is correct |
4 | Correct | 395 ms | 24596 KB | Output is correct |
5 | Correct | 402 ms | 24808 KB | Output is correct |
6 | Correct | 462 ms | 24696 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 4 ms | 384 KB | Output is correct |
4 | Correct | 3 ms | 384 KB | Output is correct |
5 | Correct | 4 ms | 384 KB | Output is correct |
6 | Correct | 3 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 394 ms | 24760 KB | Output is correct |
2 | Correct | 319 ms | 24696 KB | Output is correct |
3 | Correct | 352 ms | 24824 KB | Output is correct |
4 | Correct | 395 ms | 24596 KB | Output is correct |
5 | Correct | 402 ms | 24808 KB | Output is correct |
6 | Correct | 462 ms | 24696 KB | Output is correct |
7 | Correct | 3 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 4 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 | 3 ms | 384 KB | Output is correct |
13 | Correct | 380 ms | 23184 KB | Output is correct |
14 | Correct | 478 ms | 23856 KB | Output is correct |
15 | Correct | 367 ms | 22392 KB | Output is correct |
16 | Correct | 405 ms | 23192 KB | Output is correct |
17 | Correct | 547 ms | 27384 KB | Output is correct |
18 | Correct | 503 ms | 27256 KB | Output is correct |
19 | Correct | 567 ms | 27336 KB | Output is correct |
20 | Correct | 560 ms | 27504 KB | Output is correct |
21 | Correct | 537 ms | 27280 KB | Output is correct |
22 | Correct | 565 ms | 27256 KB | Output is correct |
23 | Correct | 527 ms | 27204 KB | Output is correct |
24 | Correct | 521 ms | 27248 KB | Output is correct |
25 | Correct | 478 ms | 24640 KB | Output is correct |
26 | Correct | 424 ms | 24568 KB | Output is correct |
27 | Correct | 687 ms | 26876 KB | Output is correct |
28 | Correct | 560 ms | 27188 KB | Output is correct |
29 | Correct | 598 ms | 26744 KB | Output is correct |
30 | Correct | 567 ms | 26888 KB | Output is correct |
31 | Correct | 525 ms | 27096 KB | Output is correct |
32 | Correct | 307 ms | 23188 KB | Output is correct |
33 | Correct | 2 ms | 256 KB | Output is correct |