이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include"books.h"
using namespace std;
void solve(int N, int K, long long A, int S) {
// cin >> N >> K >> S >> A;
long long x[N + 1];
long long sm = 0;
int f = 0;
K--;
for (int i = 1; i < 2;i++){
// cin >> x[i];
//x[i] = skim(i);
sm += x[i];
f++;
if (f > K){sm -= x[i - K - 1];}
int l = K,r = N + 1;
if (f >= K){
while (l + 1 < r){
int md = (l + r) / 2;
if ((x[md] + sm) > 2ll * A)r = md;
else l = md;
}
sm += x[l];
}
if (f >= K and sm >= A and sm <= 2LL * A){
vector<int>v;
v.push_back(l);
for (int j = i - K; j <= i; j++){
// cout << j << " ";
v.push_back(j);
}
// cout << '\n';
answer(v);
}
}
K++;
f = 0;
sm = 0;
for (int i = 1; i <= S + 1;i++){
// cin >> x[i];
x[i] = skim(i);
sm += x[i];
f++;
if (f > K){sm -= x[i - K - 1];}
if (f >= K and sm >= A and sm <= 2LL * A){
vector<int>v;
for (int j = i - K; j <= i; j++){
// cout << j << " ";
v.push_back(j);
}
// cout << '\n';
answer(v);
}
}
// cout << -1;
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... |