# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
20637 |
2017-02-13T05:58:22 Z |
model_code |
None (KOI16_resort) |
C++11 |
|
0 ms |
1196 KB |
#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
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 time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1196 KB |
Output is correct |
2 |
Correct |
0 ms |
1196 KB |
Output is correct |
3 |
Correct |
0 ms |
1196 KB |
Output is correct |
4 |
Correct |
0 ms |
1196 KB |
Output is correct |
5 |
Correct |
0 ms |
1196 KB |
Output is correct |
6 |
Correct |
0 ms |
1196 KB |
Output is correct |
7 |
Correct |
0 ms |
1196 KB |
Output is correct |
8 |
Correct |
0 ms |
1196 KB |
Output is correct |
9 |
Correct |
0 ms |
1196 KB |
Output is correct |
10 |
Correct |
0 ms |
1196 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1196 KB |
Output is correct |
2 |
Correct |
0 ms |
1196 KB |
Output is correct |
3 |
Correct |
0 ms |
1196 KB |
Output is correct |
4 |
Correct |
0 ms |
1196 KB |
Output is correct |
5 |
Correct |
0 ms |
1196 KB |
Output is correct |
6 |
Correct |
0 ms |
1196 KB |
Output is correct |
7 |
Correct |
0 ms |
1196 KB |
Output is correct |
8 |
Correct |
0 ms |
1196 KB |
Output is correct |
9 |
Correct |
0 ms |
1196 KB |
Output is correct |
10 |
Correct |
0 ms |
1196 KB |
Output is correct |
11 |
Correct |
0 ms |
1196 KB |
Output is correct |
12 |
Correct |
0 ms |
1196 KB |
Output is correct |
13 |
Correct |
0 ms |
1196 KB |
Output is correct |
14 |
Correct |
0 ms |
1196 KB |
Output is correct |
15 |
Correct |
0 ms |
1196 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1196 KB |
Output is correct |
2 |
Correct |
0 ms |
1196 KB |
Output is correct |
3 |
Correct |
0 ms |
1196 KB |
Output is correct |
4 |
Correct |
0 ms |
1196 KB |
Output is correct |
5 |
Correct |
0 ms |
1196 KB |
Output is correct |
6 |
Correct |
0 ms |
1196 KB |
Output is correct |
7 |
Correct |
0 ms |
1196 KB |
Output is correct |
8 |
Correct |
0 ms |
1196 KB |
Output is correct |
9 |
Correct |
0 ms |
1196 KB |
Output is correct |
10 |
Correct |
0 ms |
1196 KB |
Output is correct |
11 |
Correct |
0 ms |
1196 KB |
Output is correct |
12 |
Correct |
0 ms |
1196 KB |
Output is correct |
13 |
Correct |
0 ms |
1196 KB |
Output is correct |
14 |
Correct |
0 ms |
1196 KB |
Output is correct |
15 |
Correct |
0 ms |
1196 KB |
Output is correct |
16 |
Correct |
0 ms |
1196 KB |
Output is correct |
17 |
Correct |
0 ms |
1196 KB |
Output is correct |
18 |
Correct |
0 ms |
1196 KB |
Output is correct |
19 |
Correct |
0 ms |
1196 KB |
Output is correct |
20 |
Correct |
0 ms |
1196 KB |
Output is correct |
21 |
Correct |
0 ms |
1196 KB |
Output is correct |
22 |
Correct |
0 ms |
1196 KB |
Output is correct |
23 |
Correct |
0 ms |
1196 KB |
Output is correct |
24 |
Correct |
0 ms |
1196 KB |
Output is correct |
25 |
Correct |
0 ms |
1196 KB |
Output is correct |
26 |
Correct |
0 ms |
1196 KB |
Output is correct |
27 |
Correct |
0 ms |
1196 KB |
Output is correct |
28 |
Correct |
0 ms |
1196 KB |
Output is correct |
29 |
Correct |
0 ms |
1196 KB |
Output is correct |
30 |
Correct |
0 ms |
1196 KB |
Output is correct |
31 |
Correct |
0 ms |
1196 KB |
Output is correct |
32 |
Correct |
0 ms |
1196 KB |
Output is correct |
33 |
Correct |
0 ms |
1196 KB |
Output is correct |
34 |
Correct |
0 ms |
1196 KB |
Output is correct |
35 |
Correct |
0 ms |
1196 KB |
Output is correct |
36 |
Correct |
0 ms |
1196 KB |
Output is correct |
37 |
Correct |
0 ms |
1196 KB |
Output is correct |
38 |
Correct |
0 ms |
1196 KB |
Output is correct |
39 |
Correct |
0 ms |
1196 KB |
Output is correct |
40 |
Correct |
0 ms |
1196 KB |
Output is correct |
41 |
Correct |
0 ms |
1196 KB |
Output is correct |
42 |
Correct |
0 ms |
1196 KB |
Output is correct |
43 |
Correct |
0 ms |
1196 KB |
Output is correct |
44 |
Correct |
0 ms |
1196 KB |
Output is correct |