Submission #1064176

#TimeUsernameProblemLanguageResultExecution timeMemory
1064176VMaksimoski008Holiday (IOI14_holiday)C++17
23 / 100
11 ms2160 KiB
#include "holiday.h" #include <bits/stdc++.h> using namespace std; using ll = long long; ll findMaxAttraction(int n, int start, int d, int attraction[]) { if(start == 0) { ll ans = 0, sum = 0; priority_queue<ll, vector<ll>, greater<ll> > pq; for(int i=0; i<min(d, n); i++) { pq.push(attraction[i]); sum += attraction[i]; while(pq.size() > d - i) { sum -= pq.top(); pq.pop(); } ans = max(ans, sum); } return ans; } return 0; }

Compilation message (stderr)

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