| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1346283 | nathlol2 | 선물상자 (IOI15_boxes) | C++20 | 1 ms | 344 KiB |
#include "boxes.h"
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll INF = 4e18;
ll delivery(int n, int k, int l, int p[]){
auto f = [&](ll x, ll y){
return min((ll)l, min(y * 2, (l - x) * 2));
};
vector<ll> dp(n + 1, INF);
dp[0] = 0;
priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<pair<ll, int>>> pq;
for(int i = 1;i<=n;i++){
dp[i] = dp[max(0, i - k)] + min(l, 2 * p[i - 1]);
while(!pq.empty() && pq.top().second <= i - k) pq.pop();
if(pq.size()){
dp[i] = min(dp[i], pq.top().first);
}
pq.push({dp[i] + 2 * (l - p[i - 1]), i});
}
return dp[n];
}
| # | 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... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
