Submission #1007408

#TimeUsernameProblemLanguageResultExecution timeMemory
1007408NintsiChkhaidzeHoliday (IOI14_holiday)C++17
47 / 100
5067 ms5468 KiB
#include"holiday.h" #include <bits/stdc++.h> #define ll long long using namespace std; const int N = 2e5 + 3; long long int findMaxAttraction(int n, int start, int d, int attraction[]) { ll ans = 0; for (int L = 0; L <= start; L++){ multiset <int> st; ll sum = 0; for (int i = L; i < start; i++){ st.insert(attraction[i]); sum += attraction[i]; } for (int R = start; R < n; R++){ st.insert(attraction[R]); sum += attraction[R]; if (R - start < start - L) continue; int cnt = d - (R - L) - (start - L); while (st.size() > max(0,cnt)){ sum -= *st.begin(); st.erase(st.begin()); } ans=max(ans,sum); } } for (int L = 0; L <= start; L++){ multiset <int> st; ll sum = 0; for (int i = L; i < start; i++){ st.insert(attraction[i]); sum += attraction[i]; } for (int R = start; R < n; R++){ st.insert(attraction[R]); sum += attraction[R]; if (R - start > start - L) continue; int cnt = d - (R - L) - (R - start); while (st.size() > max(0,cnt)){ 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:24:24: warning: comparison of integer expressions of different signedness: 'std::multiset<int>::size_type' {aka 'long unsigned int'} and 'const int' [-Wsign-compare]
   24 |       while (st.size() > max(0,cnt)){
      |              ~~~~~~~~~~^~~~~~~~~~~~
holiday.cpp:45:24: warning: comparison of integer expressions of different signedness: 'std::multiset<int>::size_type' {aka 'long unsigned int'} and 'const int' [-Wsign-compare]
   45 |       while (st.size() > max(0,cnt)){
      |              ~~~~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...