# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
432795 | REALITYNB | Holiday (IOI14_holiday) | C++17 | 33 ms | 5276 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |