結果
問題 | No.472 平均順位 |
ユーザー | ch1channn |
提出日時 | 2023-04-08 01:25:51 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 849 ms / 2,000 ms |
コード長 | 857 bytes |
コンパイル時間 | 126 ms |
コンパイル使用メモリ | 82,296 KB |
実行使用メモリ | 77,600 KB |
最終ジャッジ日時 | 2024-04-12 10:22:09 |
合計ジャッジ時間 | 5,181 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 32 ms
52,132 KB |
testcase_01 | AC | 34 ms
52,868 KB |
testcase_02 | AC | 32 ms
53,312 KB |
testcase_03 | AC | 31 ms
52,860 KB |
testcase_04 | AC | 42 ms
63,592 KB |
testcase_05 | AC | 35 ms
52,524 KB |
testcase_06 | AC | 38 ms
61,084 KB |
testcase_07 | AC | 55 ms
69,040 KB |
testcase_08 | AC | 86 ms
76,928 KB |
testcase_09 | AC | 105 ms
77,068 KB |
testcase_10 | AC | 95 ms
76,996 KB |
testcase_11 | AC | 160 ms
77,152 KB |
testcase_12 | AC | 133 ms
77,112 KB |
testcase_13 | AC | 283 ms
77,168 KB |
testcase_14 | AC | 762 ms
77,600 KB |
testcase_15 | AC | 342 ms
77,312 KB |
testcase_16 | AC | 849 ms
77,024 KB |
testcase_17 | AC | 713 ms
76,660 KB |
testcase_18 | AC | 125 ms
77,296 KB |
testcase_19 | AC | 177 ms
76,988 KB |
ソースコード
import sys if sys.platform =='ios': import clipboard a=clipboard.get() a = a.split('\n') text = '\n'.join(a) with open('input_file.txt','w') as f: f.write(text) sys.stdin = open('input_file.txt') sys.setrecursionlimit(410000000) stdin = sys.stdin ni = lambda: int(ns()) ni_1 = lambda: int(ns())-1 na = lambda: list(map(int, stdin.readline().split())) ns = lambda: stdin.readline().strip() nm = lambda: map(int,input().split()) na_1 = lambda: list(map(lambda x:int(x)*(-1), stdin.readline().split())) na_2 = lambda: list(map(lambda x:int(x)-1, stdin.readline().split())) N,P = nm() INF = 10**10 dp = [INF]*(P+1) dp[0] = 0 for _ in range(N): a,b,c = nm() for i in range(P,-1,-1): mi = dp[i]+a if i >= 1: mi = min(mi,dp[i-1]+b) if i >= 2: mi = min(mi,dp[i-2]+c) if i >= 3: mi = min(mi,dp[i-3]+1) dp[i] = mi print(dp[-1]/N)