Submission #149091

# Submission time Handle Problem Language Result Execution time Memory
149091 2019-09-01T05:43:56 Z ummm(#3574, cerberus, aayush9, knandy) Crosses on the Grid (FXCUP4_cross) C++17
0 / 100
6 ms 384 KB
/* 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
1 Correct 5 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 5 ms 128 KB Output is correct
4 Incorrect 5 ms 384 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 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 128 KB Output is correct
4 Incorrect 5 ms 384 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 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 128 KB Output is correct
4 Incorrect 5 ms 384 KB Output isn't correct
5 Halted 0 ms 0 KB -