답안 #148491

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
148491 2019-09-01T04:32:41 Z 강력한 한방 필살기(#3595, gs14004, kriii, OnionPringles) 십자가 놓기 (FXCUP4_cross) C++17
63 / 100
118 ms 5740 KB
#include "cross.h"
#include <bits/stdc++.h>
#define sz(v) ((int)(v).size())
using namespace std;
using pi = pair<int, int>;
using lint = long long;
const int MAXN = 200005;

int N;
lint X[MAXN], Y[MAXN];
lint dp[21][MAXN];

lint func(lint X, lint Y){
	return 2 * X * Y - X * X;
}

long long SelectCross(int K, std::vector<int> I, std::vector<int> O) {
	if(K > 20) return 69;
	N = I.size();
	vector<pi> v, A;
	for(int i=0; i<N; i++) v.emplace_back(I[i], O[i]);
	sort(v.begin(), v.end());
	reverse(v.begin(), v.end());
	priority_queue<int, vector<int>, greater<int> > pq;
	lint ret = 0;
	for(int i=0; i<sz(v); ){
		int e = i;
		while(e < sz(v) && v[i].first == v[e].first) e++;
		for(int j=i; j<e; j++) pq.push(v[j].second);
		while(sz(pq) > K) pq.pop();
		if(sz(pq) == K) ret = max(ret, func(v[i].first, pq.top()));
		i = e;
	}
	return ret;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 380 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 12 ms 768 KB Output is correct
6 Correct 110 ms 5740 KB Output is correct
7 Correct 114 ms 5740 KB Output is correct
8 Correct 114 ms 5736 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 380 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 12 ms 768 KB Output is correct
6 Correct 110 ms 5740 KB Output is correct
7 Correct 114 ms 5740 KB Output is correct
8 Correct 114 ms 5736 KB Output is correct
9 Correct 7 ms 304 KB Output is correct
10 Correct 6 ms 384 KB Output is correct
11 Correct 6 ms 376 KB Output is correct
12 Correct 12 ms 768 KB Output is correct
13 Correct 64 ms 3184 KB Output is correct
14 Correct 115 ms 5740 KB Output is correct
15 Correct 118 ms 5740 KB Output is correct
16 Correct 116 ms 5732 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 380 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 12 ms 768 KB Output is correct
6 Correct 110 ms 5740 KB Output is correct
7 Correct 114 ms 5740 KB Output is correct
8 Correct 114 ms 5736 KB Output is correct
9 Correct 7 ms 304 KB Output is correct
10 Correct 6 ms 384 KB Output is correct
11 Correct 6 ms 376 KB Output is correct
12 Correct 12 ms 768 KB Output is correct
13 Correct 64 ms 3184 KB Output is correct
14 Correct 115 ms 5740 KB Output is correct
15 Correct 118 ms 5740 KB Output is correct
16 Correct 116 ms 5732 KB Output is correct
17 Incorrect 6 ms 384 KB Output isn't correct
18 Halted 0 ms 0 KB -