# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
915306 | Trisanu_Das | Holiday (IOI14_holiday) | C++17 | 0 ms | 0 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 <bit/stdc++.h>
#include "holiday.h"
using namespace std;
long long findMaxAttraction(int n, int s, int k, int a[]){
long long ans = 0;
if(s == 0){
multiset<int> ss; long long curr;
for(int j = 0; j < min(n, k - 1); j++){
ss.insert(a[i]);
curr += a[i];
while(j + ss.size() > k){
curr -= *ss.begin();
s.erase(s.begin());
}
ans = max(ans, curr);
}
return ans;
}
}