#include "cross.h"
#include <bits/stdc++.h>
using namespace std;
long long SelectCross(int k, std::vector<int> a, std::vector<int> b) {
int n = (int)a.size();
pair<int, int> c[200005] = {};
for (int i = 0; i < n; i++) c[i] = {b[i], a[i]};
sort(c, c + n); reverse(c, c + n);
multiset<int> s;
for (int i = 0; i < k; i++) s.insert(c[i].second);
long long z = 1ll * c[k - 1].first * c[k - 1].first - 1ll * *s.rbegin() * *s.rbegin();
for (int i = k; i < n; i++) {
s.insert(c[i].second);
s.erase(s.find(*s.rbegin()));
z = max(z, 1ll * c[i].first * c[i].first - 1ll * *s.rbegin() * *s.rbegin());
}
return z;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
1968 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
1968 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
1968 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |