#include "cross.h"
#include <bits/stdc++.h>
#define F first
#define S second
#define mp make_pair
#define pb push_back
//#define ll __int128
#define ll long long
#define LEFT(a) ((a)<<1)
#define RIGHT(a) (LEFT(a) + 1)
#define MID(a,b) ((a+b)>>1)
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define y1 y122
using namespace std;
const ll NN = 200005, M = 1e9;
int n;
pair < ll, ll > P[NN];
ll L[NN], R[NN];
ll ans, pas;
priority_queue < ll > Q;
ll SelectCross(int K, std::vector<int> aaa, std::vector<int> bbb) {
n = (int)aaa.size();
for (int i = 1; i <= n; i++){
P[i].F = aaa[i - 1];
P[i].S = bbb[i - 1];
}
sort (P + 1, P + n + 1);
for (int i = 1; i <= n; i++){
L[i] = P[i].F;
R[i] = P[i].S;
}
for (int i = n; i >= 1; i--){
if ((int)Q.size() == K - 1){
ll x = L[i];
ll y = R[i];
if (K > 1)
y = -Q.top();
if (y > R[i])
y = R[i];
pas = y * y - (x - y) * (x - y);
ans = max (ans, pas);
}
Q.push (-R[i]);
if ((int)Q.size() >= K)
Q.pop();
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
6 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
6 ms |
384 KB |
Output is correct |
5 |
Correct |
12 ms |
1024 KB |
Output is correct |
6 |
Correct |
114 ms |
9960 KB |
Output is correct |
7 |
Correct |
110 ms |
9700 KB |
Output is correct |
8 |
Correct |
111 ms |
9956 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
6 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
6 ms |
384 KB |
Output is correct |
5 |
Correct |
12 ms |
1024 KB |
Output is correct |
6 |
Correct |
114 ms |
9960 KB |
Output is correct |
7 |
Correct |
110 ms |
9700 KB |
Output is correct |
8 |
Correct |
111 ms |
9956 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 |
512 KB |
Output is correct |
12 |
Correct |
13 ms |
1024 KB |
Output is correct |
13 |
Correct |
60 ms |
5360 KB |
Output is correct |
14 |
Correct |
115 ms |
9836 KB |
Output is correct |
15 |
Correct |
111 ms |
9956 KB |
Output is correct |
16 |
Correct |
115 ms |
9960 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
6 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
6 ms |
384 KB |
Output is correct |
5 |
Correct |
12 ms |
1024 KB |
Output is correct |
6 |
Correct |
114 ms |
9960 KB |
Output is correct |
7 |
Correct |
110 ms |
9700 KB |
Output is correct |
8 |
Correct |
111 ms |
9956 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 |
512 KB |
Output is correct |
12 |
Correct |
13 ms |
1024 KB |
Output is correct |
13 |
Correct |
60 ms |
5360 KB |
Output is correct |
14 |
Correct |
115 ms |
9836 KB |
Output is correct |
15 |
Correct |
111 ms |
9956 KB |
Output is correct |
16 |
Correct |
115 ms |
9960 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
6 ms |
512 KB |
Output is correct |
19 |
Correct |
14 ms |
1280 KB |
Output is correct |
20 |
Correct |
67 ms |
5360 KB |
Output is correct |
21 |
Correct |
93 ms |
7912 KB |
Output is correct |
22 |
Correct |
132 ms |
9960 KB |
Output is correct |
23 |
Correct |
119 ms |
9956 KB |
Output is correct |
24 |
Correct |
125 ms |
10224 KB |
Output is correct |
25 |
Correct |
124 ms |
12008 KB |
Output is correct |
26 |
Correct |
112 ms |
12008 KB |
Output is correct |