Submission #149428

#TimeUsernameProblemLanguageResultExecution timeMemory
149428이 대회 미분 되나요? (#200)Crosses on the Grid (FXCUP4_cross)C++17
100 / 100
127 ms6884 KiB
#include "cross.h" #include<vector> #include<queue> #include<algorithm> using namespace std; #define INF 1234567890 #define ll long long ll res = 0; vector<pair<int, int> > v; priority_queue<int> 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++) v.push_back({ I[i], O[i] }); sort(v.rbegin(), v.rend()); int in_min = INF; for (int i = 0; i < K; i++) { pq.push(-v[i].second); in_min = min(in_min, v[i].first); } res = max(res, 2LL * -pq.top()*in_min - (ll)in_min*in_min); for (int i = K; i < N; i++) { pq.push(-v[i].second); in_min = min(in_min, v[i].first); pq.pop(); res = max(res, 2LL * -pq.top()*in_min - (ll)in_min*in_min); } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...