답안 #149946

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
149946 2019-09-01T07:26:27 Z GucciBelt(#3697, PeppaPig, win11905, DodgeBallMan) 십자가 놓기 (FXCUP4_cross) C++17
0 / 100
6 ms 384 KB
#include <bits/stdc++.h>
#include "cross.h"
#define long long long 
#define pii pair<int, int>
#define x first
#define y second
using namespace std;

int n;
long ans;

long SelectCross(int K, vector<int> I, vector<int> O) {
	n = I.size();
	vector<pii> vec;
	for(int i = 0; i < n; ++i) vec.emplace_back(O[i], I[i]);
	sort(vec.begin(), vec.end(), greater<pii>());
	priority_queue<int> Q;
	for(auto x : vec) {
		Q.emplace(x.y);
		if(Q.size() == K+1) Q.pop();
		if(Q.size() == K) {
			int v = min(x.y, Q.top());
			ans = max(ans, 1ll * x.x * x.x - 4ll * (x.x - v) * (x.x - v));
		}
	}
	return ans;
}

Compilation message

cross.cpp: In function 'long long int SelectCross(int, std::vector<int>, std::vector<int>)':
cross.cpp:20:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(Q.size() == K+1) Q.pop();
      ~~~~~~~~~^~~~~~
cross.cpp:21:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(Q.size() == K) {
      ~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -