# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
379272 | 2021-03-17T19:37:15 Z | nafis_shifat | Worst Reporter 3 (JOI18_worst_reporter3) | C++14 | 637 ms | 11372 KB |
#include<bits/stdc++.h> #define ll long long #define pii pair<int,int> using namespace std; const int mxn=1e5+5; const int inf=1e9; int main() { int n,q; cin >> n >> q; ll d[n + 1]; for(int i = 1; i <= n; i++) scanf("%lld",&d[i]); ll jump[n + 2]; jump[0] = 1; for(int i = 1; i <= n; i++) { jump[i] = jump[i - 1] * ((d[i] + jump[i - 1] - 1) / jump[i - 1]); } while(q--) { ll t,l,r; scanf("%lld %lld %lld",&t,&l,&r); int lo = 0; int hi = n; int upb = -1,lwb = -1; while(lo <= hi) { int mid = lo + hi >> 1; ll x = t / jump[mid]; ll p = -mid + x * jump[mid]; if(p <= r) { upb = mid; hi = mid - 1; } else { lo = mid + 1; } } lo = 0; hi = n; while(lo <= hi) { int mid = lo + hi >> 1; ll x = t / jump[mid]; ll p = -mid + x * jump[mid]; if(p >= l) { lwb = mid; lo = mid + 1; } else { hi = mid - 1; } } int ans; if(lwb < upb || lwb == -1) ans = 0; else ans = lwb - upb + 1; printf("%d\n",ans ); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 637 ms | 11372 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 637 ms | 11372 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |