Submission #148118

# Submission time Handle Problem Language Result Execution time Memory
148118 2019-08-31T14:02:49 Z 조팍시\n123(#3740, tlwpdus, ainta, cki86201) Crosses on the Grid (FXCUP4_cross) C++17
0 / 100
87 ms 14084 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];
const ll LINF = 0x3f3f3f3f3f3f3f3f;

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.empty()?LINF:pq.top())-arr[i].first*arr[i].first);
        pq.push(arr[i].second);
        pq.pop();
	}

	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 380 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 8 ms 888 KB Output is correct
6 Runtime error 87 ms 14084 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 380 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 8 ms 888 KB Output is correct
6 Runtime error 87 ms 14084 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 380 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 8 ms 888 KB Output is correct
6 Runtime error 87 ms 14084 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Halted 0 ms 0 KB -