結果

問題 No.2463 ストレートフラッシュ
ユーザー ニックネーム
提出日時 2023-09-08 22:16:38
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 462 bytes
コンパイル時間 84 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 20,736 KB
最終ジャッジ日時 2024-06-26 15:22:33
合計ジャッジ時間 27,244 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 TLE * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

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