이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "cross.h"
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<db,db> pdb;
typedef tuple<int,int,int,int> TP;
typedef vector<vector<ll>> mat;
const int N=2e5+5;
const ll mod=1e9+7;
int n,k;
ll ans;
pll p[N];
priority_queue<ll,vector<ll>,greater<ll>> pq;
long long SelectCross(int K, std::vector<int> I, std::vector<int> O) {
n=I.size(); k=K;
for(int i=1;i<=n;i++){
p[i]=pll(I[i-1],O[i-1]);
}
sort(p+1,p+1+n);
for(int i=n;i>=1;i--){
if(pq.size()==k-1){
ll v=min(pq.top(),p[i].se);
ans=max(ans,p[i].fi*(2LL*v-p[i].fi));
//cout<<p[i].fi<<" : "<<pq.top()<<" "<<" "<<v<<ans<<endl;
}
pq.push(p[i].se);
if(pq.size()==k) pq.pop();
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
cross.cpp: In function 'long long int SelectCross(int, std::vector<int>, std::vector<int>)':
cross.cpp:26:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if(pq.size()==k-1){
~~~~~~~~~^~~~~
cross.cpp:32:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if(pq.size()==k) pq.pop();
~~~~~~~~~^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |