이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
#define F(i,s,e) for (int i = s; i<e; i++)
using namespace std;
#include "books.h"
using namespace std;
//
// --- Sample implementation for the task books ---
//
// To compile this program with the sample grader, place:
// books.h books_sample.cpp sample_grader.cpp
// in a single folder and run:
// g++ books_sample.cpp sample_grader.cpp
// in this folder.
//
void solve(int N, int K, long long A, int S) {
{
vector<int> d(N+1); bool b=0; int id;
vector<int> ot;
F(i,1,N+1) {
d[i] = skim(i);
if (b == 0 && d[i] >= A) {
b = 1; id = i;
}
}
ll t1 = 0;
F(i,1,K+1) {
t1 += d[i];
}
if (t1 > 2*A) impossible();
if (t1 >= A) {
F(i,1,K+1) ot.push_back(i);
answer(ot);
}
F(i,K+1,N+1) {
t1-=d[i-K];
t1+=d[i];
if (A <= t1 && t1 <= 2*A) {
F(j,i-K+1,i+1) ot.push_back(j);
answer(ot);
}
}
if (b == 0) impossible();
else {
t1=d[id];
if (id <= K-1) impossible();
F(i,1,K) t1 += d[i];
if (t1 <= 2*A) {
F(i,1,K) ot.push_back(i);
ot.push_back(id);
answer(ot);
}
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... |