結果

問題 No.472 平均順位
ユーザー ch1channnch1channn
提出日時 2023-04-07 11:25:02
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 920 bytes
コンパイル時間 326 ms
コンパイル使用メモリ 82,576 KB
実行使用メモリ 84,220 KB
最終ジャッジ日時 2024-04-10 16:12:04
合計ジャッジ時間 7,924 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
58,112 KB
testcase_01 AC 33 ms
52,736 KB
testcase_02 AC 36 ms
52,608 KB
testcase_03 AC 34 ms
52,608 KB
testcase_04 AC 44 ms
63,488 KB
testcase_05 AC 35 ms
52,864 KB
testcase_06 AC 46 ms
63,104 KB
testcase_07 AC 49 ms
64,256 KB
testcase_08 AC 91 ms
76,628 KB
testcase_09 AC 235 ms
76,672 KB
testcase_10 AC 182 ms
77,188 KB
testcase_11 AC 647 ms
76,800 KB
testcase_12 AC 479 ms
76,692 KB
testcase_13 AC 1,667 ms
77,076 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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()
ABC = []
for i in range(N):
	ABC.append(na()+[1])


INF = 10**10	
dp = [[INF]*5001*3 for i in range(2)]
dp[0][0] = 0
for i in range(N):
	for j in range(P+1):
		for k in range(4):
			if j+k <= P:
				dp[1][j+k] = min(dp[0][j]+ABC[i][k],dp[1][j+k])
	for j in range(P+1):
		dp[0][j] = dp[1][j]
		dp[1][j] = INF
		
print(dp[0][P]/N)
0