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<bits/stdc++.h>
using namespace std;
#define ll long long
long long int findMaxAttraction(int n, int start, int d, int v[]) {
ll ans = 0;
int cnt[101];
memset(cnt,0,sizeof(cnt));
for(int i=0;i<n;i++){
cnt[v[i]]++;
ll val=0;
ll cost=d-i;
for(int i=100;i>=0;i--){
ll a=cnt[i];
a=min(a,cost);
cost-=a;
val+=i*a;
}
ans=max(ans,val);
}
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... |