# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
285555 | 2qbingxuan | Holiday (IOI14_holiday) | C++14 | 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"holiday.h"
long long int findMaxAttraction(int n, int start, int d, int attraction[]) {
if(start == 0) {
int cnt[101] = {};
for(int i = 0; i < n; i++) {
++cnt[attraction[i]];
if(d - i - 1 > 0) {
int k = d - i - 1;
int ans = 0;
for(int j = 100; j >= 1; j--) {
if(k > cnt[j]) k -= cnt[j], ans += cnt[j] * j;
else ans += cnt[j] * k, k = 0;
}
cout << ans << '\n';
}
}
}
}