# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
584821 | jack715 | Holiday (IOI14_holiday) | C++14 | 17 ms | 1196 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>
#define ll long long
#define pb push_back
#define pp pop_back
#define mp make_pair
#define bb back
#define ff first
#define ss second
using namespace std;
long long int findMaxAttraction(int n, int start, int d, int attraction[]) {
ll ans = 0, D = d;
vector<int> cnt(101, 0);
for (int i = 0; i < d; i++) {
cnt[attraction[i]]++;
ll now = 0, c = d-i;
for (int j = 100; j > 0; j--) {
if (cnt[j] <= c)
now += j*cnt[j], c-=cnt[j];
else
now += j*c, c = 0;
}
ans = max(ans, now);
}
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... |