Submission #1064225

#TimeUsernameProblemLanguageResultExecution timeMemory
1064225damjandavkovHoliday (IOI14_holiday)C++17
47 / 100
5042 ms2768 KiB
#include "holiday.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; ll findMaxAttraction(int n, int a, int d, int v[]) { ll s = 0, ms = 0, i, j; priority_queue<ll> q; if (!a) { for (i = 0; i < min(n, d); i++) { q.push(-v[i]); s += v[i]; while ((int)q.size() > d - i) { s += q.top(); q.pop(); } ms = max(ms, s); } return ms; } for (i = 0; i <= a; i++) { s = 0; for (j = i; j < n; j++) { q.push(-v[j]); s += v[j]; while (!q.empty() && (int)q.size() > d - j + i - min(a - i, j - a)) { s += q.top(); q.pop(); } if (j >= a) ms = max(ms, s); } while (!q.empty()) q.pop(); } return ms; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...