Submission #412628

#TimeUsernameProblemLanguageResultExecution timeMemory
412628cfalasA Difficult(y) Choice (BOI21_books)C++14
0 / 100
14 ms328 KiB
#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){
		if(A<=s && s<=2*A){
			vector<int> ans(K);
			FOR(j,K) ans[j] = i-K+j+1;
			answer(ans);
		}
		s-=a[i-K];
		s+=a[i];
	}
		if(A<=s && s<=2*A){
			vector<int> ans(K);
			FOR(j,K) ans[j] = n-K+j+1;
			answer(ans);
		}
	impossible();
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...