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"
#include<algorithm>
#include<iostream>
#include<vector>
using namespace std;
using ll = long long;
int cnt[111];
ll findMaxAttraction(int n, int start, int d, int attraction[]) {
ll ans = 0;
for (int i = 0 ; i < n ; ++ i) {
cnt[attraction[i]]++;
}
for (int i = 0 ; i < n ; ++ i) {
int x = d - i;
ll cur = 0;
for (int y = 100 ; y >= 0 ; -- y) {
int q = min(cnt[y], x);
x -= q;
cur += q * y;
}
ans = max(ans, cur);
}
return ans;
}
# | 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... |