# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
391950 | Aldas25 | Holiday (IOI14_holiday) | C++14 | 18 ms | 2660 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;
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define REP(n) FOR(O, 1, (n))
#define f first
#define s second
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<int> vi;
long long int findMaxAttraction(int n, int start, int d, int attraction[]) {
ll ans = 0;
priority_queue<ll, vl, greater<ll>> q;
int rem = d;
ll sum = 0;
FOR(i, 0, n-1) {
q.push(attraction[i]);
sum += attraction[i];
while (q.size() > rem) {
sum -= q.top();
q.pop();
}
ans = max(ans, sum);
rem--;
if (rem <= 0) break;
}
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... |