이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#include"books.h"
using namespace std;
//using namespace __gnu_pbds;
//#define ll long long
//#define endl "\n"
//int mod=1e9+7;
//const int N=2e5+5;
//template<class x>
//using ordered_multiset = tree<x, null_type,less_equal<x>, rb_tree_tag,tree_order_statistics_node_update>;
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]);
int tmp=upper_bound(v+l+2,v+r,nd)-(v+l+2);
tmp+=(r-l+1);
tmp-=2;
//cout<<v[l]<<' '<<v[r]<<' '<<nd<<' '<<tmp<<endl;
if (tmp>=r || tmp<=l) continue;
long long chk=v[l]+v[r]+v[tmp];
if (chk>=A && chk<=na) {
//cout<<v[l]<<' '<<v[r]<<' '<<nd<<' '<<v[tmp]<<endl;
a=v[l]; b=v[tmp]; c=v[r]; 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... |