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>
#include "books.h"
#define all(v) v.begin(), v.end()
#define sz(x) (int)x.size()
#define pb push_back
#define pii pair<int, int>
#define chmin(x, v) x = min(x, v)
#define chmax(x, v) x = max(x, v)
#define print(x) cout << #x << " est " << x << endl;
#define x first
#define y second
#define int long long
using namespace std;
void solve(signed nLivres, signed aPrendre, long long borneInf, signed S) {
int deb = 1, fin = nLivres - aPrendre + 1;
map<int, int> vals;
while (fin > deb){
int mid = (deb + fin)/2 + 1;
int sum = 0;
for (int i = 0; i < aPrendre; ++i){
vals[i + mid] = skim(i + mid);
sum += vals[i + mid];
}
if (sum < borneInf)
deb = mid;
else
fin = mid - 1;
}
int sum = 0;
for (int i = 0; i < aPrendre - 1; ++i)
sum += vals[deb + i];
sum += vals[deb + aPrendre];
if (sum >= borneInf && sum <= 2 * borneInf){
vector<signed> ans;
for (int i = 0; i < aPrendre - 1; ++i)
ans.pb(deb + i);
ans.pb(deb + aPrendre);
answer(ans);
}
impossible();
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |