# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
50478 | mirbek01 | Holiday (IOI14_holiday) | C++17 | 39 ms | 3612 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"
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 2;
int n, cnt[N];
long long int findMaxAttraction(int N, int start, int d, int attraction[]) {
n = N;
if(start) return 0;
for(int i = 0; i < n; i ++)
if(attraction[i] > 100) return 0;
long long ans = 0;
for(int i = 0; i < n; i ++){
cnt[attraction[i]] ++;
long long res = 0;
if(i < d){
int now = d - i;
for(int i = 100; i >= 0; i --){
if(now >= cnt[i]){
res += cnt[i] * i;
now -= cnt[i];
} else {
res += now * i;
now = 0;
}
}
}
ans = max(ans, res);
}
return ans;
}
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... |