답안 #150936

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
150936 2019-09-01T12:20:59 Z nvmdava 십자가 놓기 (FXCUP4_cross) C++17
100 / 100
119 ms 13000 KB
#include "cross.h"
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
vector<pair<long long, long long> > cr;
 
long long res = 0;
 
priority_queue<long long> pq;
 
long long SelectCross(int K, std::vector<int> I, std::vector<int> O) {
	int n = I.size();
	for(int i = 0; i < n; i++)
		cr.push_back({I[i], O[i]});
	sort(cr.rbegin(), cr.rend());
 
	for(int i = 0; i < n; i++){
		pq.push(-cr[i].ss);
		if(i >= K) pq.pop();
		if(i >= K - 1){
			res = max(res, -pq.top() * cr[i].ff * 2 - cr[i].ff * cr[i].ff);
		}
	}
 
	return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 8 ms 1144 KB Output is correct
6 Correct 107 ms 8668 KB Output is correct
7 Correct 107 ms 10336 KB Output is correct
8 Correct 107 ms 10436 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 8 ms 1144 KB Output is correct
6 Correct 107 ms 8668 KB Output is correct
7 Correct 107 ms 10336 KB Output is correct
8 Correct 107 ms 10436 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 392 KB Output is correct
11 Correct 3 ms 424 KB Output is correct
12 Correct 8 ms 1124 KB Output is correct
13 Correct 56 ms 5364 KB Output is correct
14 Correct 110 ms 8504 KB Output is correct
15 Correct 109 ms 10344 KB Output is correct
16 Correct 108 ms 10472 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 8 ms 1144 KB Output is correct
6 Correct 107 ms 8668 KB Output is correct
7 Correct 107 ms 10336 KB Output is correct
8 Correct 107 ms 10436 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 392 KB Output is correct
11 Correct 3 ms 424 KB Output is correct
12 Correct 8 ms 1124 KB Output is correct
13 Correct 56 ms 5364 KB Output is correct
14 Correct 110 ms 8504 KB Output is correct
15 Correct 109 ms 10344 KB Output is correct
16 Correct 108 ms 10472 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 9 ms 1268 KB Output is correct
20 Correct 59 ms 5480 KB Output is correct
21 Correct 88 ms 8160 KB Output is correct
22 Correct 111 ms 9860 KB Output is correct
23 Correct 113 ms 10344 KB Output is correct
24 Correct 119 ms 10324 KB Output is correct
25 Correct 117 ms 12372 KB Output is correct
26 Correct 111 ms 13000 KB Output is correct