Submission #151466

#TimeUsernameProblemLanguageResultExecution timeMemory
151466AlexPop28Crosses on the Grid (FXCUP4_cross)C++17
100 / 100
123 ms9708 KiB
#include <bits/stdc++.h> #include "cross.h" using namespace std; long long Area(int in, int out) { return 1LL * out * out - 1LL * (out - in) * (out - in); } long long SelectCross(int k, vector<int> in, vector<int> out) { int n = in.size(); vector<int> order(n); iota(order.begin(), order.end(), 0); sort(order.begin(), order.end(), [&](int a, int b) { return in[a] > in[b]; }); priority_queue<int, vector<int>, greater<int>> min_out; long long ans = 0LL; for (int i = 0; i < n; ++i) { if (i >= k) { min_out.pop(); } min_out.emplace(out[order[i]]); if (i + 1 >= k) { ans = max(ans, Area(in[order[i]], min_out.top())); } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...