結果

問題 No.2463 ストレートフラッシュ
ユーザー ニックネームニックネーム
提出日時 2023-09-08 22:16:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 462 bytes
コンパイル時間 105 ms
コンパイル使用メモリ 10,740 KB
実行使用メモリ 18,020 KB
最終ジャッジ日時 2023-09-08 22:17:04
合計ジャッジ時間 23,892 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,824 KB
testcase_01 AC 16 ms
7,812 KB
testcase_02 AC 15 ms
7,860 KB
testcase_03 AC 17 ms
7,824 KB
testcase_04 AC 22 ms
7,816 KB
testcase_05 AC 22 ms
7,808 KB
testcase_06 AC 16 ms
7,820 KB
testcase_07 AC 18 ms
7,764 KB
testcase_08 AC 20 ms
7,800 KB
testcase_09 AC 30 ms
7,820 KB
testcase_10 AC 19 ms
7,764 KB
testcase_11 AC 16 ms
7,764 KB
testcase_12 AC 23 ms
7,808 KB
testcase_13 AC 1,403 ms
14,548 KB
testcase_14 AC 1,585 ms
15,812 KB
testcase_15 AC 1,531 ms
15,504 KB
testcase_16 AC 1,631 ms
15,952 KB
testcase_17 AC 1,864 ms
17,292 KB
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 AC 1,965 ms
17,688 KB
testcase_22 AC 1,991 ms
18,020 KB
testcase_23 AC 1,988 ms
17,768 KB
testcase_24 TLE -
権限があれば一括ダウンロードができます

ソースコード

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