Submission #1015376

#TimeUsernameProblemLanguageResultExecution timeMemory
1015376parsadox2Holiday (IOI14_holiday)C++17
23 / 100
5016 ms6232 KiB
#include "holiday.h" #include <bits/stdc++.h> using namespace std; long long int findMaxAttraction(int n, int start, int d, int attraction[]) { if(d == 0) return 0; long long ans = attraction[start]; for(int l = 0 ; l <= start ; l++) { multiset <int> st; long long sum = 0; for(int i = l ; i <= start ; i++) { sum += attraction[i]; st.insert(attraction[i]); } int D = d - (start - l); while(!st.empty() && st.size() > D) { sum -= *st.begin(); st.erase(st.begin()); } ans = max(ans , sum); for(int r = start + 1 ; r < n ; r++) { st.insert(attraction[r]); sum += attraction[r]; D = d - (r - l) - min(r - start , start - l); while(!st.empty() && st.size() > D) { 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:20:34: warning: comparison of integer expressions of different signedness: 'std::multiset<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |   while(!st.empty() && st.size() > D)
      |                        ~~~~~~~~~~^~~
holiday.cpp:31:35: warning: comparison of integer expressions of different signedness: 'std::multiset<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   31 |    while(!st.empty() && st.size() > D)
      |                         ~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...