# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1018242 | ag_1204 | Worst Reporter 3 (JOI18_worst_reporter3) | C++14 | 529 ms | 29508 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 int long long int
#define pii pair<int,int>
#define vi vector<int>
#define si set<int>
#define pb push_back
void solve() {
int n, q; cin >> n >> q;
int a[n+1], b[n+1];
b[0] = 1;
for (int i = 1; i <= n; i++) {
cin >> a[i];
b[i] = (a[i] + b[i - 1] - 1) / b[i - 1] * b[i - 1];
}
while (q--) {
int t, l, r; cin >> t >> l >> r;
int resr = n + 1, shift = 0;
int T=t;
while (t > 0) {
int i = upper_bound(b,b+n+1,t)-b-1;
int dist = t - (t % b[i]);
t -= dist, shift += dist;
resr = min(resr, n + 1 - i + max(r - (shift - i), -1LL));
}
int resl = n + 1;
shift = 0;
t=T;
while (t > 0) {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |