# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
149998 | GucciBelt (#200) | Crosses on the Grid (FXCUP4_cross) | C++17 | 6 ms | 384 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>
#include "cross.h"
#define long long long
#define pii pair<int, int>
#define x first
#define y second
using namespace std;
int n;
long ans;
long SelectCross(int K, vector<int> I, vector<int> O) {
n = I.size();
vector<pii> vec;
for(int i = 0; i < n; ++i) vec.emplace_back(O[i], I[i]);
sort(vec.begin(), vec.end(), greater<pii>());
priority_queue<int, vector<int>, greater<int> > Q;
for(auto x : vec) {
// cerr << x.x << ' ' << x.y << endl;
Q.emplace(x.y);
if(Q.size() == K+1) Q.pop();
if(Q.size() == K) {
int v = min(x.y, Q.top());
ans = max(ans, 1ll * x.x * x.x - (x.x - v) * (x.x - v));
}
}
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... |