# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
832992 | samgiz | Crosses on the Grid (FXCUP4_cross) | C++17 | 68 ms | 14584 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;
struct Cross {
uint64_t inner, outer;
};
uint64_t SelectCross(int32_t K, vector<int32_t> I, vector<int32_t> O) {
const uint32_t N = I.size();
vector<Cross> crosses(N);
for (uint32_t i = 0; i < N; i++) {
crosses[i].inner = I[i];
crosses[i].outer = O[i];
}
sort(crosses.begin(), crosses.end(), [](Cross a, Cross b) {
return a.inner > b.inner;
});
// Comparator for priority queue that will force the smallest outer to the top
const auto cmp = [](Cross a, Cross b) {
return a.outer > b.outer;
};
// Priority queue that keeps the k Cross elements with the largest
// outer diameter out of the ones that we have processed so far.
// And allows popping the one with the smallest outer diameter.
priority_queue<Cross, vector<Cross>, decltype(cmp)> q(cmp);
// Keep track of the best area so far
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |