답안 #25290

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
25290 2017-06-21T05:57:07 Z leejseo 리조트 (KOI16_resort) Python 2
100 / 100
68 ms 3 KB
from sys import maxint
def solve(n, L):
    D = [ [maxint]*(2*i + 1) for i in range(n+1)]
    D[0][0] = 0
    for i in range (n):
        for j in range(2*i +1): 
            if D[i][j] == maxint: continue
            if i+1 in L:
                D[i+1][j] = min(D[i+1][j], D[i][j])
                continue                        
            D[i+1][j] = min(D[i+1][j], D[i][j]+10000)
            for k in range(1, 4):
                if i + k > n: break
                D[i+k][j+1] = min(D[i+k][j+1], D[i][j]+25000)
            for k in range(1, 6):
                if i + k > n: break
                D[i+k][j+2] = min(D[i+k][j+2], D[i][j]+37000)
            if j >= 3:
                D[i+1][j-3] = min(D[i+1][j-3], D[i][j])            
    return min(D[n])

def main():
    n, k = map(int, raw_input().split())
    if k == 0:
        print solve(n, [])
        return
    L = map(int, raw_input().split())
    print solve(n, L)
    return
main()
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 2 KB Output is correct
2 Correct 16 ms 2 KB Output is correct
3 Correct 19 ms 2 KB Output is correct
4 Correct 17 ms 2 KB Output is correct
5 Correct 15 ms 2 KB Output is correct
6 Correct 13 ms 2 KB Output is correct
7 Correct 14 ms 2 KB Output is correct
8 Correct 14 ms 2 KB Output is correct
9 Correct 15 ms 2 KB Output is correct
10 Correct 15 ms 2 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 3 KB Output is correct
2 Correct 16 ms 3 KB Output is correct
3 Correct 16 ms 3 KB Output is correct
4 Correct 17 ms 3 KB Output is correct
5 Correct 16 ms 3 KB Output is correct
6 Correct 18 ms 3 KB Output is correct
7 Correct 19 ms 3 KB Output is correct
8 Correct 25 ms 3 KB Output is correct
9 Correct 30 ms 3 KB Output is correct
10 Correct 37 ms 3 KB Output is correct
11 Correct 54 ms 3 KB Output is correct
12 Correct 57 ms 3 KB Output is correct
13 Correct 14 ms 3 KB Output is correct
14 Correct 16 ms 3 KB Output is correct
15 Correct 15 ms 3 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 2 KB Output is correct
2 Correct 16 ms 2 KB Output is correct
3 Correct 19 ms 2 KB Output is correct
4 Correct 17 ms 2 KB Output is correct
5 Correct 15 ms 2 KB Output is correct
6 Correct 13 ms 2 KB Output is correct
7 Correct 14 ms 2 KB Output is correct
8 Correct 14 ms 2 KB Output is correct
9 Correct 15 ms 2 KB Output is correct
10 Correct 15 ms 2 KB Output is correct
11 Correct 15 ms 3 KB Output is correct
12 Correct 16 ms 3 KB Output is correct
13 Correct 16 ms 3 KB Output is correct
14 Correct 17 ms 3 KB Output is correct
15 Correct 16 ms 3 KB Output is correct
16 Correct 18 ms 3 KB Output is correct
17 Correct 19 ms 3 KB Output is correct
18 Correct 25 ms 3 KB Output is correct
19 Correct 30 ms 3 KB Output is correct
20 Correct 37 ms 3 KB Output is correct
21 Correct 54 ms 3 KB Output is correct
22 Correct 57 ms 3 KB Output is correct
23 Correct 14 ms 3 KB Output is correct
24 Correct 16 ms 3 KB Output is correct
25 Correct 15 ms 3 KB Output is correct
26 Correct 15 ms 3 KB Output is correct
27 Correct 22 ms 3 KB Output is correct
28 Correct 16 ms 3 KB Output is correct
29 Correct 15 ms 3 KB Output is correct
30 Correct 27 ms 3 KB Output is correct
31 Correct 22 ms 3 KB Output is correct
32 Correct 31 ms 3 KB Output is correct
33 Correct 28 ms 3 KB Output is correct
34 Correct 20 ms 3 KB Output is correct
35 Correct 34 ms 3 KB Output is correct
36 Correct 30 ms 3 KB Output is correct
37 Correct 26 ms 3 KB Output is correct
38 Correct 42 ms 3 KB Output is correct
39 Correct 68 ms 3 KB Output is correct
40 Correct 44 ms 3 KB Output is correct
41 Correct 48 ms 3 KB Output is correct
42 Correct 40 ms 3 KB Output is correct
43 Correct 37 ms 3 KB Output is correct
44 Correct 31 ms 3 KB Output is correct