제출 #149274

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
1492742019-09-01 06:06:28샌즈뼈 (#200)십자가 놓기 (FXCUP4_cross)C++17
100 / 100
124 ms6884 KiB
#include "cross.h"
#include <bits/stdc++.h>
using namespace std;
long long SelectCross(int K, std::vector<int> I, std::vector<int> O) {
int N = I.size();
vector<pair<int, int>> v;
for(int i=0; i<N; i++) v.emplace_back(I[i], O[i]);
sort(v.rbegin(), v.rend());
//for(int i=0;i <N; i++) cout << v[i].first << ' '; cout << endl;
//for(int i=0;i <N; i++) cout << v[i].second << ' '; cout << endl;
priority_queue<int, vector<int>, greater<int>> s;
for(int i=0; i<K-1; i++) {
s.push(v[i].second);
}
long long res = 0;
for(int i=K-1; i<N; i++) {
int ii = v[i].first;
int oo = s.size() ? min(s.top(), v[i].second) : v[i].second;
// cout << oo << ' ' << ii << endl;
res = max(res, 1LL*oo*oo - 1LL*(oo-ii)*(oo-ii));
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...