# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
100557 | 2019-03-12T08:52:32 Z | JPN20 | Worst Reporter 3 (JOI18_worst_reporter3) | C++17 | 712 ms | 13176 KB |
#include <bits/stdc++.h> using namespace std; long long N, Q, D[1 << 19]; vector<tuple<int, int, long long>>tup; long long solve(long long T, long long L, long long R) { long long sum = 0; for (int i = 0; i < tup.size(); i++) { long long E = (T / get<2>(tup[i])) * get<2>(tup[i]); long long EL = -1LL * get<1>(tup[i]) + E; long long ER = -1LL * get<0>(tup[i]) + E; long long PL = max(EL, L), PR = min(ER, R); if (PL <= PR) sum += (PR - PL + 1); } if (L <= T && T <= R) sum++; return sum; } int main() { scanf("%lld%lld", &N, &Q); for (int i = 1; i <= N; i++) { scanf("%lld", &D[i]); if (i >= 2) { D[i] += D[i - 1] - 1; D[i] /= D[i - 1]; D[i] *= D[i - 1]; } } int t = 1; for (int i = 1; i <= N; i++) { if (i == N || D[i] != D[i + 1]) { tup.push_back(make_tuple(t, i, D[i])); t = i + 1; } } for (int i = 1; i <= Q; i++) { long long T, L, R; scanf("%lld%lld%lld", &T, &L, &R); printf("%lld\n", solve(T, L, R)); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 319 ms | 13048 KB | Output is correct |
2 | Correct | 324 ms | 13012 KB | Output is correct |
3 | Correct | 321 ms | 12996 KB | Output is correct |
4 | Correct | 327 ms | 13060 KB | Output is correct |
5 | Correct | 333 ms | 13172 KB | Output is correct |
6 | Correct | 328 ms | 13176 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
2 | Correct | 3 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 356 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 3 ms | 384 KB | Output is correct |
6 | Correct | 3 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 319 ms | 13048 KB | Output is correct |
2 | Correct | 324 ms | 13012 KB | Output is correct |
3 | Correct | 321 ms | 12996 KB | Output is correct |
4 | Correct | 327 ms | 13060 KB | Output is correct |
5 | Correct | 333 ms | 13172 KB | Output is correct |
6 | Correct | 328 ms | 13176 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 | 356 KB | Output is correct |
10 | Correct | 2 ms | 384 KB | Output is correct |
11 | Correct | 3 ms | 384 KB | Output is correct |
12 | Correct | 3 ms | 384 KB | Output is correct |
13 | Correct | 386 ms | 10548 KB | Output is correct |
14 | Correct | 374 ms | 5496 KB | Output is correct |
15 | Correct | 354 ms | 10476 KB | Output is correct |
16 | Correct | 358 ms | 10312 KB | Output is correct |
17 | Correct | 558 ms | 7036 KB | Output is correct |
18 | Correct | 549 ms | 6776 KB | Output is correct |
19 | Correct | 495 ms | 6876 KB | Output is correct |
20 | Correct | 465 ms | 6904 KB | Output is correct |
21 | Correct | 468 ms | 7116 KB | Output is correct |
22 | Correct | 513 ms | 6904 KB | Output is correct |
23 | Correct | 631 ms | 6904 KB | Output is correct |
24 | Correct | 505 ms | 6904 KB | Output is correct |
25 | Correct | 475 ms | 12144 KB | Output is correct |
26 | Correct | 420 ms | 12112 KB | Output is correct |
27 | Correct | 712 ms | 7288 KB | Output is correct |
28 | Correct | 576 ms | 7192 KB | Output is correct |
29 | Correct | 561 ms | 7160 KB | Output is correct |
30 | Correct | 605 ms | 7380 KB | Output is correct |
31 | Correct | 580 ms | 7160 KB | Output is correct |
32 | Correct | 350 ms | 11256 KB | Output is correct |
33 | Correct | 2 ms | 384 KB | Output is correct |