제출 #149091

#제출 시각아이디문제언어결과실행 시간메모리
149091ummm (#200)십자가 놓기 (FXCUP4_cross)C++17
0 / 100
6 ms384 KiB
/* 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...