| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 44708 | top34051 | Worst Reporter 3 (JOI18_worst_reporter3) | C++17 | 16 ms | 656 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn = 1e3 + 5;
int n,q;
ll dist[maxn];
int get(ll T, ll L) {
    int l = 1, r = n, mid, pos = 0;
    while(l<=r) {
        mid = (l+r)/2;
        if(-mid + (T/dist[mid])*dist[mid] >= L) {
            pos = mid;
            l = mid+1;
        }
        else r = mid-1;
    }
    return pos;
}
int main() {
    scanf("%d%d",&n,&q);
    dist[0] = 1;
    for(int i=1;i<=n;i++) {
        scanf("%lld",&dist[i]);
        dist[i] = (ll)ceil((double)dist[i]/dist[i-1]) * dist[i-1];
    }
    while(q--) {
        ll T, L, R; int res = 0;
        scanf("%lld%lld%lld",&T,&L,&R);
        for(int i=0;i<=n;i++) {
            ll temp = -i+(T/dist[i])*dist[i];
            if(L<=temp && temp<=R) res++;
        }
        printf("%d\n",res);
    }
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
