Submission #947799

#TimeUsernameProblemLanguageResultExecution timeMemory
947799willychanA Difficult(y) Choice (BOI21_books)C++17
0 / 100
6 ms408 KiB
#include <bits/stdc++.h>

#include "books.h"

using namespace std;
typedef long long ll;
//
// --- 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) {
	if(K!=3) return;
	vector<ll> v(N+1);
	for(int i=1;i<=N;i++) v[i] = skim(i);
	for(int i=1;i<=N;i++){
		for(int j=i+1;j<=N;j++){
			ll g = v[i]+v[j];
			int l = lower_bound(v.begin()+j+1,v.end(),A-g)-v.begin();
			if(l>j && v[l]+g<=2*A){
				answer({i,j,l});
				return;
			}
		}
	}
	impossible();
	return ;
}
#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...