Submission #20637

#TimeUsernameProblemLanguageResultExecution timeMemory
20637model_code리조트 (KOI16_resort)C++11
100 / 100
0 ms1196 KiB
#include<stdio.h> #define MAXDAY 100 int T, N; int R[MAXDAY + 1]; int D[MAXDAY + 1][MAXDAY * 2 + 1]; void upd(int i, int j, int v) { if (i > T) return; if (D[i][j] == -1) D[i][j] = v; if (D[i][j] > v) D[i][j] = v; } int main() { int i, j, x; scanf("%d%d", &T, &N); for (i = 1; i <= T; i++) R[i] = 1; for (i = 0; i < N; i++) { scanf("%d", &x); R[x] = 0; } for (i = 0; i <= T; i++) for (j = 0; j <= T * 2; j++) D[i][j] = -1; D[0][0] = 0; for (i = 0; i < T; i++) { for (j = 0; j <= i * 2; j++) { if (D[i][j] == -1) continue; if (R[i + 1] == 0) upd(i + 1, j, D[i][j]); if (j >= 3) upd(i + 1, j - 3, D[i][j]); upd(i + 1, j, D[i][j] + 10000); upd(i + 1, j + 1, D[i][j] + 25000); upd(i + 2, j + 1, D[i][j] + 25000); upd(i + 3, j + 1, D[i][j] + 25000); upd(i + 1, j + 2, D[i][j] + 37000); upd(i + 2, j + 2, D[i][j] + 37000); upd(i + 3, j + 2, D[i][j] + 37000); upd(i + 4, j + 2, D[i][j] + 37000); upd(i + 5, j + 2, D[i][j] + 37000); } } int ans = D[T][0]; for (j = 1; j <= T * 2; j++) ans = (ans > D[T][j]) ? D[T][j] : ans; printf("%d\n", ans); return 0; }

Compilation message (stderr)

resort.cpp: In function 'int main()':
resort.cpp:17:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 scanf("%d%d", &T, &N);
                      ^
resort.cpp:20:16: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 scanf("%d", &x);
                ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...