| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 62919 | kingpig9 | Worst Reporter 3 (JOI18_worst_reporter3) | C++11 | 1458 ms | 13728 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;
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 (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... | ||||
