Submission #915324

#TimeUsernameProblemLanguageResultExecution timeMemory
915324Trisanu_DasHoliday (IOI14_holiday)C++17
47 / 100
5049 ms3976 KiB
#include <bits/stdc++.h> #include "holiday.h" using namespace std; long long findMaxAttraction(int n, int s, int d, int a[]) { long long ans = 0; for(int l = 0; l <= s; l++) { priority_queue<long long, vector<long long>, greater<long long> > pq; long long curr = 0; for (int r = l; r < n; r++) { curr += a[r]; pq.push(a[r]); int sm = min(abs(r - s), abs(l - s)) + r - l; sm = d - sm; if(sm < 0) continue; while(pq.size() > sm) curr -= pq.top(), pq.pop(); ans = max(ans, curr); } } return ans; }

Compilation message (stderr)

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:16: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]
   16 |             while(pq.size() > sm) curr -= pq.top(), pq.pop();
      |                   ~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...