Submission #1045292

#TimeUsernameProblemLanguageResultExecution timeMemory
1045292ArthuroWichHoliday (IOI14_holiday)C++17
23 / 100
5063 ms5724 KiB
#include "holiday.h" #include<bits/stdc++.h> using namespace std; #define int long long int int findMaxAttraction(int32_t n, int32_t st, int32_t d, int32_t at[]) { int ans = 0; for (int l = st; l >= 0; l--) { int co = 0; multiset<int> s; if (st-l > d) { cout << "bruh" << endl; break; } for (int i = st; i >= l; i--) { co += at[i]; s.insert(at[i]); } if (s.size() >= d-(st-l)) { ans = max(ans, co); } for (int r = st+1; r < n; r++) { if (st-l+r-st+min(r-st,st-l) > d) { break; } int k = d-(st-l+r-st+min(r-st,st-l)); s.insert(at[r]); co += at[r]; while(s.size() > k) { co -= *s.begin(); s.erase(s.begin()); } ans = max(ans, co); } } return ans; }

Compilation message (stderr)

holiday.cpp: In function 'long long int findMaxAttraction(int32_t, int32_t, int32_t, int32_t*)':
holiday.cpp:18:22: warning: comparison of integer expressions of different signedness: 'std::multiset<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   18 |         if (s.size() >= d-(st-l)) {
      |             ~~~~~~~~~^~~~~~~~~~~
holiday.cpp:28:28: warning: comparison of integer expressions of different signedness: 'std::multiset<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   28 |             while(s.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...