# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
149524 | 2019-09-01T06:40:38 Z | dragoon(#3802, dragoon) | Crosses on the Grid (FXCUP4_cross) | C++17 | 5 ms | 384 KB |
#include "cross.h" #include <utility> #include <queue> #include <algorithm> using namespace std; priority_queue<int> PQ; vector<pair<int, int>> V; long long SelectCross(int K, std::vector<int> I, std::vector<int> O) { int n = I.size(); for (int i = 0; i < n; i++) { V.push_back({I[i], O[i]}); } sort(V.begin(), V.end()); reverse(V.begin(), V.end()); for (int i = 0; i < K - 1; i++) { PQ.push(-V[i].second); } long long ret = 0; for (int i = K; i < n; i++) { PQ.push(-V[i].second); if (PQ.size() > K) PQ.pop(); long long o = -PQ.top(); long long in = V[i].first; long long now = 2 * o * in - in * in; if (now > ret) ret = now; } return ret; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |