Submission #129495

#TimeUsernameProblemLanguageResultExecution timeMemory
129495antimirageHoliday (IOI14_holiday)C++14
23 / 100
46 ms6328 KiB
#include"holiday.h" #include <bits/stdc++.h> using namespace std; multiset <int> st; long long int findMaxAttraction(int n, int start, int d, int a[]) { long long ans = 0, sum = 0; for (int i = 0; i < n; i++) { if (i >= d) break; st.insert(a[i]); sum += a[i]; int k = d - i; while (st.size() > k) { sum -= *st.begin(); st.erase(st.begin()); } ans = max(ans, sum); } return ans; }

Compilation message (stderr)

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:17:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while (st.size() > k) {
          ~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...