#include "cross.h"
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;
#define mp make_pair
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define szz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
#define ldb ldouble
typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;
int IT_MAX = 1 << 19;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
pll in[300050];
ll getarea(ll a, ll b) {
if (b >= a) return a * a;
return a * a - (a - b)*(a - b);
}
priority_queue <ll, vector<ll>, greater<ll>> Hx;
long long SelectCross(int K, std::vector<int> I, std::vector<int> O) {
int N = I.size();
for (int i = 0; i < N; i++) in[i] = pll(O[i], I[i]);
sort(in, in + N);
for (int i = N - 1; i >= N - K; i--) Hx.push(in[i].second);
ll rv = 0;
rv = getarea(in[N-K].first, Hx.top());
for (int i = N - K - 1; i >= 0; i--) {
Hx.push(in[i].second);
Hx.pop();
rv = max(rv, getarea(in[i].first, Hx.top()));
}
return rv;
}
Compilation message
cross.cpp:25:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
#pragma warning(disable:4996)
cross.cpp:26:0: warning: ignoring #pragma comment [-Wunknown-pragmas]
#pragma comment(linker, "/STACK:336777216")
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
7 ms |
384 KB |
Output is correct |
5 |
Correct |
12 ms |
768 KB |
Output is correct |
6 |
Correct |
108 ms |
6764 KB |
Output is correct |
7 |
Correct |
121 ms |
6812 KB |
Output is correct |
8 |
Correct |
117 ms |
6780 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
7 ms |
384 KB |
Output is correct |
5 |
Correct |
12 ms |
768 KB |
Output is correct |
6 |
Correct |
108 ms |
6764 KB |
Output is correct |
7 |
Correct |
121 ms |
6812 KB |
Output is correct |
8 |
Correct |
117 ms |
6780 KB |
Output is correct |
9 |
Correct |
6 ms |
384 KB |
Output is correct |
10 |
Correct |
6 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 |
63 ms |
3696 KB |
Output is correct |
14 |
Correct |
113 ms |
6760 KB |
Output is correct |
15 |
Correct |
114 ms |
6764 KB |
Output is correct |
16 |
Correct |
117 ms |
6760 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
7 ms |
384 KB |
Output is correct |
5 |
Correct |
12 ms |
768 KB |
Output is correct |
6 |
Correct |
108 ms |
6764 KB |
Output is correct |
7 |
Correct |
121 ms |
6812 KB |
Output is correct |
8 |
Correct |
117 ms |
6780 KB |
Output is correct |
9 |
Correct |
6 ms |
384 KB |
Output is correct |
10 |
Correct |
6 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 |
63 ms |
3696 KB |
Output is correct |
14 |
Correct |
113 ms |
6760 KB |
Output is correct |
15 |
Correct |
114 ms |
6764 KB |
Output is correct |
16 |
Correct |
117 ms |
6760 KB |
Output is correct |
17 |
Correct |
6 ms |
384 KB |
Output is correct |
18 |
Correct |
6 ms |
384 KB |
Output is correct |
19 |
Correct |
13 ms |
1024 KB |
Output is correct |
20 |
Correct |
65 ms |
3696 KB |
Output is correct |
21 |
Correct |
90 ms |
5480 KB |
Output is correct |
22 |
Correct |
111 ms |
6760 KB |
Output is correct |
23 |
Correct |
116 ms |
6760 KB |
Output is correct |
24 |
Correct |
123 ms |
7140 KB |
Output is correct |
25 |
Correct |
120 ms |
8816 KB |
Output is correct |
26 |
Correct |
115 ms |
8808 KB |
Output is correct |