結果

問題 No.2463 ストレートフラッシュ
ユーザー ニックネームニックネーム
提出日時 2023-09-08 22:17:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 363 ms / 2,000 ms
コード長 462 bytes
コンパイル時間 311 ms
コンパイル使用メモリ 86,828 KB
実行使用メモリ 79,784 KB
最終ジャッジ日時 2023-09-08 22:17:24
合計ジャッジ時間 6,609 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,152 KB
testcase_01 AC 70 ms
71,504 KB
testcase_02 AC 70 ms
71,208 KB
testcase_03 AC 83 ms
76,376 KB
testcase_04 AC 94 ms
76,504 KB
testcase_05 AC 92 ms
76,488 KB
testcase_06 AC 72 ms
71,256 KB
testcase_07 AC 85 ms
76,244 KB
testcase_08 AC 91 ms
76,412 KB
testcase_09 AC 106 ms
77,560 KB
testcase_10 AC 88 ms
76,344 KB
testcase_11 AC 73 ms
71,032 KB
testcase_12 AC 92 ms
76,552 KB
testcase_13 AC 256 ms
79,036 KB
testcase_14 AC 304 ms
79,344 KB
testcase_15 AC 273 ms
79,204 KB
testcase_16 AC 286 ms
79,284 KB
testcase_17 AC 315 ms
79,604 KB
testcase_18 AC 363 ms
79,784 KB
testcase_19 AC 330 ms
79,648 KB
testcase_20 AC 333 ms
79,704 KB
testcase_21 AC 291 ms
79,592 KB
testcase_22 AC 316 ms
79,600 KB
testcase_23 AC 327 ms
79,612 KB
testcase_24 AC 326 ms
79,532 KB
権限があれば一括ダウンロードができます

ソースコード

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