Submission #1032217

#TimeUsernameProblemLanguageResultExecution timeMemory
1032217tolbiHoliday (IOI14_holiday)C++17
23 / 100
5058 ms2136 KiB
#include"holiday.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; long long int findMaxAttraction(int n, int start, int d, int attraction[]) { ll ans = 0; for (int l = start; l >= 0; l--){ priority_queue<int,vector<int>,greater<int>> pq; ll somma = 0; for (int i = l; i < start; i++){ pq.push(attraction[i]); somma+=attraction[i]; } for (int r = start; r < n; r++){ pq.push(attraction[r]); somma+=attraction[r]; int mv = r-l+min(start-l,r-start); int kal = d-mv; while (pq.size()>kal){ somma-=pq.top(); pq.pop(); } ans=max(ans,somma); } } return ans; }

Compilation message (stderr)

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:19:29: warning: comparison of integer expressions of different signedness: 'std::priority_queue<int, std::vector<int>, std::greater<int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   19 |             while (pq.size()>kal){
      |                    ~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...