結果

問題 No.2463 ストレートフラッシュ
コンテスト
ユーザー ニックネーム
提出日時 2023-09-08 22:16:38
言語 Python3
(3.14.3 + numpy 2.4.2 + scipy 1.17.0)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 1,435 ms / 2,000 ms
コード長 462 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 490 ms
コンパイル使用メモリ 20,824 KB
実行使用メモリ 22,488 KB
最終ジャッジ日時 2026-03-13 08:12:43
合計ジャッジ時間 18,446 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n,m = map(int,input().split())
a = [[0]*(n+1) for _ in range(m)]
for t in range(n*m):
    j,i = map(int,input().split())
    a[i-1][j-1] = max(t-4,0)
    if j==1: a[i-1][n] = max(t-4,0)
ans = n*m
for i in range(m):
    for j in range(n-3):
        b = sorted(a[i][j:j+5])
        t = x = 0
        for k,v in enumerate(b):
            if v<=x: continue
            t += (v-x+4-k)//(5-k)
            x += (v-x+4-k)//(5-k)*(5-k)
        ans = min(ans,t)
print(ans)
0