Submission #391950

#TimeUsernameProblemLanguageResultExecution timeMemory
391950Aldas25Holiday (IOI14_holiday)C++14
23 / 100
18 ms2660 KiB
#include"holiday.h" #include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i <= (b); i++) #define REP(n) FOR(O, 1, (n)) #define f first #define s second #define pb push_back typedef long long ll; typedef pair<int, int> pii; typedef vector<pii> vii; typedef vector<ll> vl; typedef vector<int> vi; long long int findMaxAttraction(int n, int start, int d, int attraction[]) { ll ans = 0; priority_queue<ll, vl, greater<ll>> q; int rem = d; ll sum = 0; FOR(i, 0, n-1) { q.push(attraction[i]); sum += attraction[i]; while (q.size() > rem) { sum -= q.top(); q.pop(); } ans = max(ans, sum); rem--; if (rem <= 0) break; } return ans; }

Compilation message (stderr)

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:27:25: 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]
   27 |         while (q.size() > rem) {
      |                ~~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...