# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
86565 | tjdgus4384 | 리조트 (KOI16_resort) | C++14 | 3 ms | 892 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<cstdio>
#include<string.h>
#include<vector>
#include<algorithm>
using namespace std;
int cant[101];
int d[101][101], n;
int dfs(int x, int c)
{
if(x >= n + 1) return 0;
if(d[x][c] != -1) return d[x][c];
d[x][c] = 2e9;
if(cant[x]) d[x][c] = dfs(x + 1, c);
else if(c >= 3) d[x][c] = dfs(x + 1, c - 3);
else d[x][c] = dfs(x + 1, c) + 10000;
d[x][c] = min(d[x][c], dfs(x + 3, c + 1) + 25000);
d[x][c] = min(d[x][c], dfs(x + 5, c + 2) + 37000);
return d[x][c];
}
int main()
{
int m, x;
scanf("%d %d", &n, &m);
for(int i = 0;i < m;i++)
{
scanf("%d", &x);
cant[x] = 1;
}
memset(d, -1, sizeof(d));
printf("%d", dfs(1, 0));
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... |