# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
150885 | khsoo01 | Crosses on the Grid (FXCUP4_cross) | C++17 | 113 ms | 7072 KiB |
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>
#define X first
#define Y second
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
long long SelectCross(int K, vector<int> I, vector<int> O) {
vector<pii> V;
int N = I.size();
for(int i=0;i<N;i++) {
V.push_back({-I[i], O[i]});
}
sort(V.begin(), V.end());
priority_queue<int> Q;
ll ans = 0;
for(int i=0;i<N;i++) {
Q.push(-V[i].Y);
if(Q.size() > K) Q.pop();
if(i >= K-1) ans = max(ans, -1ll*V[i].X*V[i].X +2ll*V[i].X*Q.top());
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |