| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1322066 | dangcoder | Holding (COCI20_holding) | C++20 | 25 ms | 2360 KiB |
/*
'########:::::'###::::'##::: ##::'######::::'######:::'#######::'########::'########:'########::
##.... ##:::'## ##::: ###:: ##:'##... ##::'##... ##:'##.... ##: ##.... ##: ##.....:: ##.... ##:
##:::: ##::'##:. ##:: ####: ##: ##:::..::: ##:::..:: ##:::: ##: ##:::: ##: ##::::::: ##:::: ##:
##:::: ##:'##:::. ##: ## ## ##: ##::'####: ##::::::: ##:::: ##: ##:::: ##: ######::: ########::
##:::: ##: #########: ##. ####: ##::: ##:: ##::::::: ##:::: ##: ##:::: ##: ##...:::: ##.. ##:::
##:::: ##: ##.... ##: ##:. ###: ##::: ##:: ##::: ##: ##:::: ##: ##:::: ##: ##::::::: ##::. ##::
########:: ##:::: ##: ##::. ##:. ######:::. ######::. #######:: ########:: ########: ##:::. ##:
........:::..:::::..::..::::..:::......:::::......::::.......:::........:::........::..:::::..::
*/
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
if(fopen(".INP", "r")) {
freopen(".INP", "r", stdin);
freopen(".OUT", "w", stdout);
}
int n, l, r, k;
cin >> n >> l >> r >> k;
vector<int> a(n + 1);
for(int i = 1; i <= n; i++)
cin >> a[i];
int len = r - l + 1;
vector<vector<int>> dp(len + 1, vector<int>(k + 1, 1e9));
dp[0][0] = 0;
for(int i = 1; i <= n; i++)
{
for(int j = min(len, i); j >= 1; --j)
{
int d = abs(i - (l + j - 1));
for(int s = k; s >= d; s--)
dp[j][s] = min(dp[j][s], dp[j - 1][s - d] + a[i]);
}
}
int ans = 1e9;
for(int s = 0; s <= k; s++)
ans = min(ans, dp[len][s]);
cout << ans;
return 0;
}
컴파일 시 표준 에러 (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... | ||||
