This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#include"books.h"
using namespace std;
void solve(int N, int K, long long A, int S) {
long long v[N];
for (int i=0;i<N;i++) {
v[i]=skim(i+1);
}
long long na=A*2;
int a=-1,b=-1,c=-1;
for (int l=0;l<N;l++) {
for (int r=l+2;r<N;r++) {
long long nd=na-(v[l]+v[r]);
//cout<<v[l]<<' '<<v[r]<<' '<<nd<<endl;
int tmp=upper_bound(v+l+1,v+r,nd)-v+l+1;
if (tmp<N) tmp--;
else continue;
if (tmp==r) tmp--;
long long chk=v[l]+v[r]+v[tmp];
if (chk>=A && chk<=na) {
//cout<<nd<<' '<<tmp<<endl;
a=v[l]; b=v[r]; c=v[tmp]; break;
}
if (a!=-1) break;
}
}
if (a==-1) impossible();
vector<int> ans;
ans.push_back(a); ans.push_back(b); ans.push_back(c);
answer(ans);
return;
}
# | 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... |