# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
61743 | 2018-07-26T13:50:37 Z | ansol4328 | None (KOI16_resort) | C++ | 4 ms | 964 KB |
#include<stdio.h> #include<algorithm> using namespace std; int n, m, d[102]; int dp[102][50]; bool not_going[102]; int main() { int out=1e9; scanf("%d %d",&n,&m); for(int i=0 ; i<m ; i++) { scanf("%d",&d[i]); not_going[d[i]]=true; } for(int i=0 ; i<=n ; i++) for(int j=0 ; j<=45 ; j++) dp[i][j]=1e9; dp[0][0]=0; for(int i=1 ; i<=n ; i++) { for(int j=0 ; j<=45 ; j++) { dp[i][j]=min(dp[i][j],dp[i-1][j]+10000); if(i>=3 && j>=1) dp[i][j]=min(dp[i][j],dp[i-3][j-1]+25000); if(i>=5 && j>=2) dp[i][j]=min(dp[i][j],dp[i-5][j-2]+37000); if(j<=27) dp[i][j]=min(dp[i][j],dp[i-1][j+3]); if(not_going[i]) { dp[i][j]=min(dp[i][j],dp[i-1][j]); } } } for(int i=0 ; i<=45 ; i++) out=min(out,dp[n][i]); printf("%d",out); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 368 KB | Output is correct |
3 | Correct | 4 ms | 420 KB | Output is correct |
4 | Correct | 3 ms | 420 KB | Output is correct |
5 | Correct | 3 ms | 484 KB | Output is correct |
6 | Correct | 3 ms | 484 KB | Output is correct |
7 | Correct | 2 ms | 484 KB | Output is correct |
8 | Correct | 3 ms | 508 KB | Output is correct |
9 | Correct | 3 ms | 508 KB | Output is correct |
10 | Correct | 3 ms | 576 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 620 KB | Output is correct |
2 | Correct | 3 ms | 620 KB | Output is correct |
3 | Correct | 3 ms | 620 KB | Output is correct |
4 | Correct | 2 ms | 620 KB | Output is correct |
5 | Correct | 3 ms | 684 KB | Output is correct |
6 | Correct | 2 ms | 684 KB | Output is correct |
7 | Correct | 3 ms | 684 KB | Output is correct |
8 | Correct | 3 ms | 684 KB | Output is correct |
9 | Correct | 4 ms | 684 KB | Output is correct |
10 | Correct | 4 ms | 736 KB | Output is correct |
11 | Correct | 3 ms | 736 KB | Output is correct |
12 | Correct | 3 ms | 736 KB | Output is correct |
13 | Correct | 3 ms | 736 KB | Output is correct |
14 | Correct | 3 ms | 736 KB | Output is correct |
15 | Correct | 3 ms | 736 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 368 KB | Output is correct |
3 | Correct | 4 ms | 420 KB | Output is correct |
4 | Correct | 3 ms | 420 KB | Output is correct |
5 | Correct | 3 ms | 484 KB | Output is correct |
6 | Correct | 3 ms | 484 KB | Output is correct |
7 | Correct | 2 ms | 484 KB | Output is correct |
8 | Correct | 3 ms | 508 KB | Output is correct |
9 | Correct | 3 ms | 508 KB | Output is correct |
10 | Correct | 3 ms | 576 KB | Output is correct |
11 | Correct | 3 ms | 620 KB | Output is correct |
12 | Correct | 3 ms | 620 KB | Output is correct |
13 | Correct | 3 ms | 620 KB | Output is correct |
14 | Correct | 2 ms | 620 KB | Output is correct |
15 | Correct | 3 ms | 684 KB | Output is correct |
16 | Correct | 2 ms | 684 KB | Output is correct |
17 | Correct | 3 ms | 684 KB | Output is correct |
18 | Correct | 3 ms | 684 KB | Output is correct |
19 | Correct | 4 ms | 684 KB | Output is correct |
20 | Correct | 4 ms | 736 KB | Output is correct |
21 | Correct | 3 ms | 736 KB | Output is correct |
22 | Correct | 3 ms | 736 KB | Output is correct |
23 | Correct | 3 ms | 736 KB | Output is correct |
24 | Correct | 3 ms | 736 KB | Output is correct |
25 | Correct | 3 ms | 736 KB | Output is correct |
26 | Correct | 4 ms | 824 KB | Output is correct |
27 | Correct | 2 ms | 824 KB | Output is correct |
28 | Correct | 3 ms | 824 KB | Output is correct |
29 | Correct | 4 ms | 824 KB | Output is correct |
30 | Correct | 3 ms | 824 KB | Output is correct |
31 | Correct | 3 ms | 824 KB | Output is correct |
32 | Correct | 3 ms | 824 KB | Output is correct |
33 | Correct | 2 ms | 828 KB | Output is correct |
34 | Correct | 2 ms | 832 KB | Output is correct |
35 | Correct | 2 ms | 836 KB | Output is correct |
36 | Correct | 4 ms | 840 KB | Output is correct |
37 | Correct | 3 ms | 844 KB | Output is correct |
38 | Correct | 3 ms | 848 KB | Output is correct |
39 | Correct | 3 ms | 852 KB | Output is correct |
40 | Correct | 2 ms | 856 KB | Output is correct |
41 | Correct | 3 ms | 860 KB | Output is correct |
42 | Correct | 3 ms | 864 KB | Output is correct |
43 | Correct | 3 ms | 964 KB | Output is correct |
44 | Correct | 2 ms | 964 KB | Output is correct |