Submission #152025

#TimeUsernameProblemLanguageResultExecution timeMemory
152025tmwilliamlin168Crosses on the Grid (FXCUP4_cross)C++17
100 / 100
117 ms10476 KiB
#include "cross.h" #include <bits/stdc++.h> using namespace std; array<int, 2> a[200000]; long long SelectCross(int k, vector<int> x, vector<int> y) { long long ans=0; for(int i=0; i<x.size(); ++i) a[i]={x[i], y[i]}; sort(a, a+x.size(), greater<>()); priority_queue<int, vector<int>, greater<int>> pq; for(int i=0; i<k-1; ++i) pq.push(a[i][1]); for(int i=k-1; i<x.size(); ++i) { pq.push(a[i][1]); ans=max((long long)a[i][0]*(2*pq.top()-a[i][0]), ans); pq.pop(); } return ans; }

Compilation message (stderr)

cross.cpp: In function 'long long int SelectCross(int, std::vector<int>, std::vector<int>)':
cross.cpp:9:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<x.size(); ++i)
               ~^~~~~~~~~
cross.cpp:15:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=k-1; i<x.size(); ++i) {
                 ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...