結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
61,160 KB
testcase_01 AC 31 ms
52,812 KB
testcase_02 AC 30 ms
52,928 KB
testcase_03 AC 31 ms
52,868 KB
testcase_04 AC 41 ms
63,568 KB
testcase_05 AC 33 ms
54,524 KB
testcase_06 AC 41 ms
64,312 KB
testcase_07 AC 43 ms
64,884 KB
testcase_08 AC 84 ms
76,464 KB
testcase_09 AC 224 ms
76,648 KB
testcase_10 AC 170 ms
76,764 KB
testcase_11 AC 581 ms
77,200 KB
testcase_12 AC 431 ms
76,640 KB
testcase_13 AC 1,522 ms
77,428 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]*((5000*3)+1) 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