이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "books.h"
using namespace std;
map <int ,long long> mem;
long long ask(int i){
if(mem.count(i))
return mem[i];
return mem[i] = skim(i);
}
vector <int> range(int l ,int r){
vector <int> ret;
for(int i = l; i <= r; i++)
ret.push_back(i);
return ret;
}
void solve(int N, int K, long long A, int S) {
int l = 1 ,r = N ,m;
while(l <= r){
m = (l+r)>>1;
if(ask(m) > A/K)
r = m-1;
else
l = m+1;
}
r = max(K ,l);
l = r-K+1;
long long tot = 0;
for(int i = l; i <= r; i++)
tot += ask(i);
while(tot <= 2*A){
if(tot >= A)
answer(range(l ,r));
if(r == N)
impossible();
tot += ask(++r);
tot -= ask(l++);
}
auto ans = range(1 ,K-1);
ans.push_back(r);
tot = 0;
for(int&i : ans)
tot += ask(i);
if(A <= tot && tot <= 2*A)
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... |