# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
159562 | geon040702 | 리조트 (KOI16_resort) | C++14 | 2 ms | 504 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 <bits/stdc++.h>
using namespace std;
int main(void)
{
int payment[110][110] = {0}, close[110] = {0};
int n, m, res, i, j, k;
res = 999999;
scanf("%d %d", &n, &m);
if(m != 0)
{
for(i=1;i<=m;i++)
{
scanf("%d", &k);
close[k] = 1;
}
}
for(i=0;i<=n;i++)
{
for(j=0;j<=n;j++)
payment[i][j] = 9999999;
}
payment[0][0] = 0;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if(payment[i][j] == 9999999) {
continue;
}
if(close[i+1] == 1) {
payment[i+1][j] = payment[i][j];
}
payment[i+1][j] = min(payment[i+1][j], payment[i][j] + 10000);
payment[i+3][j+1] = min(payment[i+3][j+1], payment[i][j] + 25000);
payment[i+5][j+2] = min(payment[i+5][j+2], payment[i][j] + 37000);
if(j >= 3) {
payment[i+1][j-3] = min(payment[i+1][j-3], payment[i][j]);
}
}
}
for(i=0;i<=n;i++)
{
res = min(res, payment[n][i]);
}
printf("%d", res);
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... |