Submission #150936

#TimeUsernameProblemLanguageResultExecution timeMemory
150936nvmdavaCrosses on the Grid (FXCUP4_cross)C++17
100 / 100
119 ms13000 KiB
#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; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...