# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
205525 | 2020-02-29T05:54:23 Z | PeppaPig | Worst Reporter 3 (JOI18_worst_reporter3) | C++14 | 927 ms | 26616 KB |
#include <bits/stdc++.h> #define long long long using namespace std; const int N = 5e5+5; int n, q; long s[N], t[N]; int cnt(long T, long R) { int l = 0, r = n; while(l < r) { int mid = (l + r) >> 1; if(s[mid] * (T / t[mid]) - mid <= R) r = mid; else l = mid + 1; } return n + 1 - r; } int main() { scanf("%d %d", &n, &q); s[0] = t[0] = 1; for(int i = 1, d; i <= n; i++) { scanf("%d", &d); long k = d / s[i-1] + (d % s[i-1] != 0); s[i] = s[i-1] * k, t[i] = t[i-1] * k; } for(int i = 1, t, l, r; i <= q; i++) { scanf("%d %d %d", &t, &l, &r); printf("%d\n", cnt(t, r) - cnt(t, l-1)); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 927 ms | 26616 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 6 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 380 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 927 ms | 26616 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |