#include "cross.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll>pll;
int n, k;
pll arr[100100];
long long SelectCross(int K, std::vector<int> I, std::vector<int> O) {
priority_queue<ll,vector<ll>,greater<ll>> pq;
n = I.size();
k = K;
for (int i=0;i<n;i++) {
arr[i] = {I[i],O[i]};
}
sort(arr,arr+n);
for (int i=n-k+1;i<n;i++) {
pq.push(arr[i].second);
}
ll ans = 0;
for (int i=n-k;i>=0;i--){
ans = max(ans,2*arr[i].first*min(arr[i].second,pq.top())-arr[i].first*arr[i].first);
pq.push(arr[i].second);
pq.pop();
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
3 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
3 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
3 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |