Submission #148113

# Submission time Handle Problem Language Result Execution time Memory
148113 2019-08-31T14:00:08 Z 조팍시\n123(#3740, tlwpdus, ainta, cki86201) Crosses on the Grid (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;
}
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -