Submission #412629

#TimeUsernameProblemLanguageResultExecution timeMemory
412629cfalasA Difficult(y) Choice (BOI21_books)C++14
0 / 100
16 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+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+1){
		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;
			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...