Submission #832992

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
8329922023-08-21 18:32:58samgizCrosses on the Grid (FXCUP4_cross)C++17
100 / 100
68 ms14584 KiB
#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
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...