Submission #915315

#TimeUsernameProblemLanguageResultExecution timeMemory
915315Trisanu_DasHoliday (IOI14_holiday)C++17
24 / 100
5046 ms5460 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 ; for(int i=start;i<n;i++){ multiset<int> el ; for(int j=start;j<=i;j++) el.insert(a[j]) ; int sum = 0; int rest = d-(i-start) ; if(rest<0) break ; while(el.size()>rest) el.erase(el.begin()); for(int x: el) sum+=x ; ans=max(ans,sum) ; for(int j=start-1;j>-1;--j){ rest = d-(min(start-j,i-start)*2+max(start-j,i-start)); if(rest<0) break ; el.insert(a[j]) ; sum+=a[j] ; while(el.size()>rest){ sum-=*el.begin(); el.erase(el.begin()) ; } ans=max(ans,sum) ; } } return ans ; #undef int }

Compilation message (stderr)

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:13:24: 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]
   13 |         while(el.size()>rest)
      |               ~~~~~~~~~^~~~~
holiday.cpp:22: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]
   22 |             while(el.size()>rest){
      |                   ~~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...