# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
62918 | 2018-07-30T20:29:32 Z | kingpig9 | Worst Reporter 3 (JOI18_worst_reporter3) | C++11 | 1671 ms | 263168 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 5e5 + 10; const ll INF = 2e9; #define debug(...) fprintf(stderr, __VA_ARGS__) #define fi first #define se second #define all(v) (v).begin(), (v).end() #define fillchar(a, s) memset((a), (s), sizeof(a)) int N, Q; ll P[MAXN]; int moo (ll t, ll x) { int lo = 0, hi = N + 2; //how many are >= x? while (hi - lo > 1) { int mid = (lo + hi) / 2; if (P[mid - 1] * (t / P[mid - 1]) - (mid - 1) >= x) { lo = mid; } else { hi = mid; } } return lo; } int main() { scanf("%d %d", &N, &Q); P[0] = 1; for (int i = 1; i <= N; i++) { ll d; scanf("%lld", &d); P[i] = ((d + P[i - 1] - 1) / P[i - 1]) * P[i - 1]; } for (int qi = 0; qi < Q; qi++) { ll t, lt, rt; scanf("%lld %lld %lld", &t, <, &rt); printf("%d\n", moo(t, lt) - moo(t, rt + 1)); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1256 ms | 16704 KB | Output is correct |
2 | Correct | 1169 ms | 17464 KB | Output is correct |
3 | Correct | 1572 ms | 22316 KB | Output is correct |
4 | Correct | 1387 ms | 27180 KB | Output is correct |
5 | Correct | 1449 ms | 42568 KB | Output is correct |
6 | Correct | 1315 ms | 57944 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 57944 KB | Output is correct |
2 | Correct | 3 ms | 57944 KB | Output is correct |
3 | Correct | 3 ms | 57944 KB | Output is correct |
4 | Correct | 3 ms | 57944 KB | Output is correct |
5 | Correct | 4 ms | 57944 KB | Output is correct |
6 | Correct | 3 ms | 57944 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1256 ms | 16704 KB | Output is correct |
2 | Correct | 1169 ms | 17464 KB | Output is correct |
3 | Correct | 1572 ms | 22316 KB | Output is correct |
4 | Correct | 1387 ms | 27180 KB | Output is correct |
5 | Correct | 1449 ms | 42568 KB | Output is correct |
6 | Correct | 1315 ms | 57944 KB | Output is correct |
7 | Correct | 4 ms | 57944 KB | Output is correct |
8 | Correct | 3 ms | 57944 KB | Output is correct |
9 | Correct | 3 ms | 57944 KB | Output is correct |
10 | Correct | 3 ms | 57944 KB | Output is correct |
11 | Correct | 4 ms | 57944 KB | Output is correct |
12 | Correct | 3 ms | 57944 KB | Output is correct |
13 | Correct | 1041 ms | 71968 KB | Output is correct |
14 | Correct | 977 ms | 88532 KB | Output is correct |
15 | Correct | 924 ms | 103788 KB | Output is correct |
16 | Correct | 973 ms | 119572 KB | Output is correct |
17 | Correct | 1258 ms | 139452 KB | Output is correct |
18 | Correct | 1060 ms | 158216 KB | Output is correct |
19 | Correct | 1091 ms | 176676 KB | Output is correct |
20 | Correct | 1089 ms | 187148 KB | Output is correct |
21 | Correct | 1203 ms | 187148 KB | Output is correct |
22 | Correct | 1236 ms | 187148 KB | Output is correct |
23 | Correct | 1130 ms | 187168 KB | Output is correct |
24 | Correct | 1151 ms | 187232 KB | Output is correct |
25 | Correct | 1671 ms | 203260 KB | Output is correct |
26 | Correct | 1610 ms | 218644 KB | Output is correct |
27 | Correct | 1141 ms | 236136 KB | Output is correct |
28 | Correct | 1192 ms | 254188 KB | Output is correct |
29 | Runtime error | 1171 ms | 263168 KB | Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience. |
30 | Halted | 0 ms | 0 KB | - |