# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
149567 | 2019-09-01T06:45:23 Z | dragoon(#3802, dragoon) | 십자가 놓기 (FXCUP4_cross) | C++17 | 129 ms | 6888 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 - 1; 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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 432 KB | Output is correct |
2 | Correct | 5 ms | 128 KB | Output is correct |
3 | Correct | 6 ms | 256 KB | Output is correct |
4 | Correct | 6 ms | 384 KB | Output is correct |
5 | Correct | 12 ms | 768 KB | Output is correct |
6 | Correct | 115 ms | 5736 KB | Output is correct |
7 | Correct | 118 ms | 5736 KB | Output is correct |
8 | Correct | 116 ms | 5732 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 432 KB | Output is correct |
2 | Correct | 5 ms | 128 KB | Output is correct |
3 | Correct | 6 ms | 256 KB | Output is correct |
4 | Correct | 6 ms | 384 KB | Output is correct |
5 | Correct | 12 ms | 768 KB | Output is correct |
6 | Correct | 115 ms | 5736 KB | Output is correct |
7 | Correct | 118 ms | 5736 KB | Output is correct |
8 | Correct | 116 ms | 5732 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
12 | Correct | 13 ms | 768 KB | Output is correct |
13 | Correct | 65 ms | 3184 KB | Output is correct |
14 | Correct | 120 ms | 5740 KB | Output is correct |
15 | Correct | 123 ms | 5616 KB | Output is correct |
16 | Correct | 118 ms | 5744 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 432 KB | Output is correct |
2 | Correct | 5 ms | 128 KB | Output is correct |
3 | Correct | 6 ms | 256 KB | Output is correct |
4 | Correct | 6 ms | 384 KB | Output is correct |
5 | Correct | 12 ms | 768 KB | Output is correct |
6 | Correct | 115 ms | 5736 KB | Output is correct |
7 | Correct | 118 ms | 5736 KB | Output is correct |
8 | Correct | 116 ms | 5732 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
12 | Correct | 13 ms | 768 KB | Output is correct |
13 | Correct | 65 ms | 3184 KB | Output is correct |
14 | Correct | 120 ms | 5740 KB | Output is correct |
15 | Correct | 123 ms | 5616 KB | Output is correct |
16 | Correct | 118 ms | 5744 KB | Output is correct |
17 | Correct | 5 ms | 384 KB | Output is correct |
18 | Correct | 5 ms | 384 KB | Output is correct |
19 | Correct | 13 ms | 768 KB | Output is correct |
20 | Correct | 67 ms | 3184 KB | Output is correct |
21 | Correct | 97 ms | 5096 KB | Output is correct |
22 | Correct | 123 ms | 5740 KB | Output is correct |
23 | Correct | 121 ms | 5480 KB | Output is correct |
24 | Correct | 128 ms | 5736 KB | Output is correct |
25 | Correct | 129 ms | 6624 KB | Output is correct |
26 | Correct | 113 ms | 6888 KB | Output is correct |