結果

問題 No.2463 ストレートフラッシュ
ユーザー sasa8uyauyasasa8uyauya
提出日時 2023-09-09 00:52:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 315 ms / 2,000 ms
コード長 398 bytes
コンパイル時間 851 ms
コンパイル使用メモリ 87,168 KB
実行使用メモリ 79,648 KB
最終ジャッジ日時 2023-09-09 00:52:48
合計ジャッジ時間 6,370 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,192 KB
testcase_01 AC 68 ms
71,324 KB
testcase_02 AC 69 ms
71,280 KB
testcase_03 AC 80 ms
76,568 KB
testcase_04 AC 88 ms
76,580 KB
testcase_05 AC 89 ms
76,780 KB
testcase_06 AC 72 ms
71,136 KB
testcase_07 AC 81 ms
76,680 KB
testcase_08 AC 86 ms
76,684 KB
testcase_09 AC 98 ms
77,136 KB
testcase_10 AC 98 ms
76,652 KB
testcase_11 AC 71 ms
71,400 KB
testcase_12 AC 88 ms
76,736 KB
testcase_13 AC 243 ms
78,820 KB
testcase_14 AC 268 ms
79,056 KB
testcase_15 AC 260 ms
79,192 KB
testcase_16 AC 293 ms
79,172 KB
testcase_17 AC 298 ms
79,516 KB
testcase_18 AC 314 ms
79,568 KB
testcase_19 AC 315 ms
79,648 KB
testcase_20 AC 313 ms
79,580 KB
testcase_21 AC 277 ms
79,372 KB
testcase_22 AC 313 ms
79,568 KB
testcase_23 AC 303 ms
79,484 KB
testcase_24 AC 311 ms
79,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m=map(int,input().split())
c=[[0]*(n+1) for i in range(m)]
for i in range(n*m):
	s,t=map(int,input().split())
	s-=1
	t-=1
	c[t][s]=max(0,i-4)
	if s==0:
		c[t][n]=max(0,i-4)
a=n*m
for i in range(m):
	for j in range(n-3):
		g=c[i][j:j+5]
		g.sort()
		b=0
		bb=0
		for k in range(5):
			if g[k]<=bb:
				continue
			b+=(g[k]-bb+5-k-1)//(5-k)
			bb+=(g[k]-bb+5-k-1)//(5-k)*(5-k)
		a=min(a,b)
print(a)
0