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 "cross.h"
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
vector<pair<long long, long long> > cr;
long long res = 0;
priority_queue<long long> pq;
long long SelectCross(int K, std::vector<int> I, std::vector<int> O) {
int n = I.size();
for(int i = 0; i < n; i++)
cr.push_back({I[i], O[i]});
sort(cr.rbegin(), cr.rend());
for(int i = 0; i < n; i++){
pq.push(-cr[i].ss);
if(i >= K) pq.pop();
if(i >= K - 1){
res = max(res, -pq.top() * cr[i].ff * 2 - cr[i].ff * cr[i].ff);
}
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |