# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
150885 | 2019-09-01T09:53:48 Z | khsoo01 | Crosses on the Grid (FXCUP4_cross) | C++17 | 113 ms | 7072 KB |
#include "cross.h" #include<bits/stdc++.h> #define X first #define Y second using namespace std; typedef pair<int,int> pii; typedef long long ll; long long SelectCross(int K, vector<int> I, vector<int> O) { vector<pii> V; int N = I.size(); for(int i=0;i<N;i++) { V.push_back({-I[i], O[i]}); } sort(V.begin(), V.end()); priority_queue<int> Q; ll ans = 0; for(int i=0;i<N;i++) { Q.push(-V[i].Y); if(Q.size() > K) Q.pop(); if(i >= K-1) ans = max(ans, -1ll*V[i].X*V[i].X +2ll*V[i].X*Q.top()); } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 8 ms | 760 KB | Output is correct |
6 | Correct | 102 ms | 5612 KB | Output is correct |
7 | Correct | 105 ms | 5724 KB | Output is correct |
8 | Correct | 103 ms | 5628 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 8 ms | 760 KB | Output is correct |
6 | Correct | 102 ms | 5612 KB | Output is correct |
7 | Correct | 105 ms | 5724 KB | Output is correct |
8 | Correct | 103 ms | 5628 KB | Output is correct |
9 | Correct | 2 ms | 256 KB | Output is correct |
10 | Correct | 2 ms | 256 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 8 ms | 680 KB | Output is correct |
13 | Correct | 54 ms | 3056 KB | Output is correct |
14 | Correct | 104 ms | 5668 KB | Output is correct |
15 | Correct | 110 ms | 5604 KB | Output is correct |
16 | Correct | 105 ms | 5584 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 8 ms | 760 KB | Output is correct |
6 | Correct | 102 ms | 5612 KB | Output is correct |
7 | Correct | 105 ms | 5724 KB | Output is correct |
8 | Correct | 103 ms | 5628 KB | Output is correct |
9 | Correct | 2 ms | 256 KB | Output is correct |
10 | Correct | 2 ms | 256 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 8 ms | 680 KB | Output is correct |
13 | Correct | 54 ms | 3056 KB | Output is correct |
14 | Correct | 104 ms | 5668 KB | Output is correct |
15 | Correct | 110 ms | 5604 KB | Output is correct |
16 | Correct | 105 ms | 5584 KB | Output is correct |
17 | Correct | 2 ms | 256 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 8 ms | 760 KB | Output is correct |
20 | Correct | 58 ms | 3032 KB | Output is correct |
21 | Correct | 84 ms | 4976 KB | Output is correct |
22 | Correct | 107 ms | 5612 KB | Output is correct |
23 | Correct | 113 ms | 5668 KB | Output is correct |
24 | Correct | 113 ms | 5612 KB | Output is correct |
25 | Correct | 113 ms | 6624 KB | Output is correct |
26 | Correct | 110 ms | 7072 KB | Output is correct |