이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/* cerberus97 - Hanit Banga */
#include "cross.h"
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
using namespace std;
#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
const ll inf = 1e18 + 42;
ll SelectCross(int K, std::vector<int> I, std::vector<int> O) {
int N = I.size();
vector<pll> C(N);
for (int i = 0; i < N; ++i) {
C[i] = {I[i], O[i]};
}
sort(C.begin(), C.end(), greater<pll>());
ll mn = inf, best = 0;
for (int i = 0; i < N; ++i) {
mn = min(mn, C[i].second);
if (i >= K - 1) {
best = max(best, C[i].first * (2 * mn - C[i].first));
}
}
return best;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |