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>
#ifdef local
#define debug(...) qqbx(#__VA_ARGS__, __VA_ARGS__)
void qqbx(const char *s) {}
template <typename H, typename ...T> void qqbx(const char *s, const H& h, T&& ...args) {
for(; *s && *s != ','; ++s) if(*s != ' ') std::cerr << *s;
std::cerr << " = " << h << (sizeof...(T) ? ", " : "\n");
if(sizeof...(T)) qqbx(++s, args...);
}
#define safe std::cerr<<__PRETTY_FUNCTION__<<" line "<<__LINE__<<" safe\n"
#else
#define debug(...) ((void)0)
#define safe ((void)0)
#endif // local
#define pb emplace_back
#define all(v) begin(v),end(v)
using namespace std;
long long int findMaxAttraction(int n, int start, int d, int attraction[]) {
if(start == 0 && *max_element(attraction,attraction+n) <= 100) {
int cnt[101] = {};
int mx = 0;
for(int i = 0; i < n; i++) {
++cnt[attraction[i]];
if(d - i > 0) {
int k = d - i;
int ans = 0;
for(int j = 100; j >= 1; j--) {
if(k >= cnt[j]) k -= cnt[j], ans += cnt[j] * j;
else ans += k * j, k = 0;
}
mx = max(mx, ans);
}
}
return mx;
}
return 0;
}
# | 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... |