이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "cross.h"
#include<bits/stdc++.h>
//using namespace std;
long long SelectCross(int K, std::vector<int> I, std::vector<int> O) {
int N = I.size();
std::pair<long long, long long> soo[N];
for ( int i = 0 ; i < N ; ++i ) {
soo[i] = {O[i], I[i]};
}
sort(soo, soo + N, std::greater< std::pair<long long, long long> >());
std::priority_queue<long long, std::vector<long long>, std::greater<long long>> puts;
for ( int i = 0 ; i < K ; ++i ) {
puts.push(soo[i].second);
}
long long out = soo[K-1].first;
long long in = puts.top();
long long ret = out * out - (out-in) * (out-in);
for ( int i = K ; i < N ; ++i ) {
out = soo[i].first;
puts.pop();
puts.push(soo[i].second);
in = puts.top();
ret = std::max(ret, out * out - (out-in) * (out-in) );
}
return ret;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |