# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
250457 | jwvg0425 | Holiday (IOI14_holiday) | C++17 | 19 ms | 1664 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 <queue>
using namespace std;
long long int fromZero(int n, int d, int attraction[])
{
priority_queue<int, vector<int>, greater<int>> q;
long long int now = 0;
long long int ans = 0;
for (int i = 0; i < n; i++)
{
// 0 -> i까지 간다고 했을 때 관광지 방문에 쓸 수 있는 날짜
int canVisit = d - i;
now += attraction[i];
q.push(attraction[i]);
while (q.size() > canVisit)
{
now -= q.top();
q.pop();
}
ans = max(ans, now);
}
return ans;
}
long long int findMaxAttraction(int n, int start, int d, int attraction[])
{
if (start == 0)
return fromZero(n, d, attraction);
// O(N^2)
return 0;
}
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... |