# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
150548 | Ian and 2-bit memory (#200) | Crosses on the Grid (FXCUP4_cross) | C++17 | 124 ms | 6636 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 <bits/stdc++.h>
using namespace std;
#include "cross.h"
long long SelectCross(int K, vector<int> I, vector<int> O) {
int N = I.size();
vector<pair<int, int>> v(N);
for (int i = 0; i < N; i++)
v[i] = {O[i], I[i]};
sort(v.begin(), v.end(), greater<pair<int, int>>());
priority_queue<int, vector<int>, greater<int>> q;
long long ans = 0;
for (auto& i : v) {
q.push(i.second);
if (q.size() > K)
q.pop();
if (q.size() == K) {
long long ta = i.first;
long long tb = ta - q.top();
ans = max(ans, ta * ta - tb * tb);
}
}
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... |