제출 #1064225

#제출 시각아이디문제언어결과실행 시간메모리
1064225damjandavkov휴가 (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...