Submission #148622

# Submission time Handle Problem Language Result Execution time Memory
148622 2019-09-01T04:47:23 Z 맞WATLE(#3593, arnold518, ksmzzang2003, songc) Crosses on the Grid (FXCUP4_cross) C++17
0 / 100
5 ms 380 KB
#include <bits/stdc++.h>
#include "cross.h"
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

int N, K;
LL ans;
pii A[202020];
priority_queue<LL, vector<LL>, greater<LL>> PQ; 

long long SelectCross(int k, std::vector<int> I, std::vector<int> O) {
	N = I.size(), K = k;
	for (int i=1; i<=N; i++) A[i] = pii(I[i-1], O[i-1]);
	sort(A+1, A+N+1, [&](pii a, pii b){
		return a.first > b.first;
	});
	for (int i=1; i<=K; i++) PQ.push(A[i].second);
	ans = 2*A[K].first*PQ.top() - A[K].first*A[K].first;
	for (int i=K+1; i<=N; i++){
		PQ.push(A[i].second);
		PQ.pop();
		ans = max(ans, 2*A[i].first*PQ.top() - A[i].first*A[i].first);
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 380 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 380 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 380 KB Output isn't correct
2 Halted 0 ms 0 KB -