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 <bits/stdc++.h>
#include "cross.h"
using namespace std;
long long Area(int in, int out) {
return 1LL * out * out - 1LL * (out - in) * (out - in);
}
long long SelectCross(int k, vector<int> in, vector<int> out) {
int n = in.size();
vector<int> order(n);
iota(order.begin(), order.end(), 0);
sort(order.begin(), order.end(), [&](int a, int b) {
return in[a] > in[b];
});
priority_queue<int, vector<int>, greater<int>> min_out;
long long ans = 0LL;
for (int i = 0; i < n; ++i) {
if (i >= k) {
min_out.pop();
}
min_out.emplace(out[order[i]]);
if (i + 1 >= k) {
ans = max(ans, Area(in[order[i]], min_out.top()));
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |