이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define INF 10000000
#define MOD 1000000007
#define MID ((l+r)/2)
#define HASHMOD 2305843009213693951
#define ll long long
#define ull unsigned long long
#define F first
#define S second
typedef pair<ll, ll> ii;
typedef pair<ii, int> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef map<int, int> mii;
#define EPS 1e-6
#define FOR(i,n) for(int i=0;i<((int)(n));i++)
#define FORi(i,a,b) for(int i=((int)(a));i<((int)(b));i++)
#define FOA(v, a) for(auto v : a)
#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) {
assert(S>=n);
vi a(n);
FOR(i,n) a[i] = skim(i+1);
FOR(i,n-1) assert(a[i+1]>a[i]);
ll s=0;
FOR(i,K) s+=a[i];
FORi(i,K, n+1){
if(A<=s && s<=2*A){
vector<int> ans(K);
FOR(j,K) ans[j] = i-K+j+1;
answer(ans);
}
if(i!=n){
s-=a[i-K];
s+=a[i];
}
}
s=0;
FOR(i,K-1) s+=a[i];
FORi(i,K-1, n){
if(A<=s+a[i] && s+a[i]<=2*A){
vector<int> ans(K);
FOR(j,K-1) ans[j] = j+1;
ans[K-1] = i+1;
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... |