# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
149046 | 2019-09-01T05:38:27 Z | 1 WA = 5 Push Up(#3624, BaaaaaaaaaaaaaaaarkingDog, IohcEjnim, 0xrgb) | Crosses on the Grid (FXCUP4_cross) | C++17 | 119 ms | 6888 KB |
#include "cross.h" #include <set> #include <utility> #include <algorithm> #include <queue> #define X first #define Y second using namespace std; long long SelectCross(int K, std::vector<int> I, std::vector<int> O) { int N = I.size(); vector<pair<int,int> > V(N); for(int i = 0; i < N; i++){ V[i] = {I[i], O[i]}; } sort(V.begin(),V.end()); long long mx = -1; priority_queue<int, vector<int>, less<int> > PQ1; // 큰 것 부터 튀어나옴 priority_queue<int, vector<int>, greater<int> > PQ2; // 작은 것 부터 나감 for(int i = N-1; i >= 0; i--){ if(PQ2.size() < K) PQ2.push(V[i].Y); else{ PQ1.push(V[i].Y); while(PQ1.top() > PQ2.top()){ int v1 = PQ1.top(); int v2 = PQ2.top(); PQ1.pop(); PQ2.pop(); PQ1.push(v2); PQ2.push(v1); } } if(PQ2.size() < K) continue; mx = max(mx, 2ll*PQ2.top()*V[i].X - 1ll*V[i].X*V[i].X); } return mx; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 6 ms | 384 KB | Output is correct |
4 | Correct | 6 ms | 384 KB | Output is correct |
5 | Correct | 11 ms | 816 KB | Output is correct |
6 | Correct | 108 ms | 6632 KB | Output is correct |
7 | Correct | 113 ms | 6628 KB | Output is correct |
8 | Correct | 113 ms | 6408 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 6 ms | 384 KB | Output is correct |
4 | Correct | 6 ms | 384 KB | Output is correct |
5 | Correct | 11 ms | 816 KB | Output is correct |
6 | Correct | 108 ms | 6632 KB | Output is correct |
7 | Correct | 113 ms | 6628 KB | Output is correct |
8 | Correct | 113 ms | 6408 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 6 ms | 384 KB | Output is correct |
12 | Correct | 12 ms | 768 KB | Output is correct |
13 | Correct | 59 ms | 3572 KB | Output is correct |
14 | Correct | 108 ms | 6628 KB | Output is correct |
15 | Correct | 108 ms | 6504 KB | Output is correct |
16 | Correct | 110 ms | 6632 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 6 ms | 384 KB | Output is correct |
4 | Correct | 6 ms | 384 KB | Output is correct |
5 | Correct | 11 ms | 816 KB | Output is correct |
6 | Correct | 108 ms | 6632 KB | Output is correct |
7 | Correct | 113 ms | 6628 KB | Output is correct |
8 | Correct | 113 ms | 6408 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 6 ms | 384 KB | Output is correct |
12 | Correct | 12 ms | 768 KB | Output is correct |
13 | Correct | 59 ms | 3572 KB | Output is correct |
14 | Correct | 108 ms | 6628 KB | Output is correct |
15 | Correct | 108 ms | 6504 KB | Output is correct |
16 | Correct | 110 ms | 6632 KB | Output is correct |
17 | Correct | 5 ms | 384 KB | Output is correct |
18 | Correct | 7 ms | 384 KB | Output is correct |
19 | Correct | 15 ms | 768 KB | Output is correct |
20 | Correct | 63 ms | 3568 KB | Output is correct |
21 | Correct | 92 ms | 5608 KB | Output is correct |
22 | Correct | 111 ms | 6632 KB | Output is correct |
23 | Correct | 108 ms | 6636 KB | Output is correct |
24 | Correct | 117 ms | 6888 KB | Output is correct |
25 | Correct | 119 ms | 6632 KB | Output is correct |
26 | Correct | 108 ms | 6668 KB | Output is correct |