답안 #148113

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
148113 2019-08-31T14:00:08 Z 조팍시\n123(#3740, tlwpdus, ainta, cki86201) 십자가 놓기 (FXCUP4_cross) C++17
0 / 100
3 ms 504 KB
#include "cross.h"
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll,ll>pll;

int n, k;
pll arr[100100];

long long SelectCross(int K, std::vector<int> I, std::vector<int> O) {
    priority_queue<ll,vector<ll>,greater<ll>> pq;
	n = I.size();
	k = K;
	for (int i=0;i<n;i++) {
        arr[i] = {I[i],O[i]};
	}
	sort(arr,arr+n);
	for (int i=n-k+1;i<n;i++) {
        pq.push(arr[i].second);
	}
	ll ans = 0;
	for (int i=n-k;i>=0;i--){
        ans = max(ans,2*arr[i].first*min(arr[i].second,pq.top())-arr[i].first*arr[i].first);
        pq.push(arr[i].second);
        pq.pop();
	}

	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -