Submission #432795

#TimeUsernameProblemLanguageResultExecution timeMemory
432795REALITYNBHoliday (IOI14_holiday)C++17
0 / 100
33 ms5276 KiB
#include <bits/stdc++.h> #include "holiday.h" using namespace std; long long findMaxAttraction(int n , int start , int d , int* a){ #define int long long int ans = 0 , sum= 0; multiset<int> el ; for(int i=start;i<n;i++){ el.insert(a[i]) ; sum+=a[i] ; while(el.size()>d){ sum-=*el.begin() ; ans=max(ans,sum); el.erase(el.begin()); } --d; } return ans ; #undef int } /*int main(){ int a[5]= {10,2,20,30,1} ; cout << findMaxAttraction(5,2,7,a) ; return 0 ; } */

Compilation message (stderr)

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:11:24: warning: comparison of integer expressions of different signedness: 'std::multiset<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   11 |         while(el.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...