Submission #499743

#TimeUsernameProblemLanguageResultExecution timeMemory
499743dxz05Holiday (IOI14_holiday)C++14
47 / 100
5073 ms5336 KiB
#include"holiday.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; long long findMaxAttraction(int n, int start, int d, int attraction[]) { ll ans = 0; for (int l = 0; l <= start; l++){ multiset<int> s; ll sum = 0; for (int r = l; r < n; r++){ s.insert(attraction[r]); sum += attraction[r]; if (r < start) continue; int free = d - (r - l); free -= min(r - start, start - l); if (free <= 0) break; while (s.size() > free){ sum -= *s.begin(); s.erase(s.begin()); } ans = max(ans, sum); } } return ans; }

Compilation message (stderr)

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