結果

問題 No.2463 ストレートフラッシュ
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2023-09-08 22:48:50
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 595 bytes
コンパイル時間 1,214 ms
コンパイル使用メモリ 87,052 KB
実行使用メモリ 100,116 KB
最終ジャッジ日時 2023-09-08 22:49:32
合計ジャッジ時間 5,981 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
75,932 KB
testcase_01 AC 72 ms
71,012 KB
testcase_02 AC 76 ms
71,236 KB
testcase_03 AC 94 ms
76,036 KB
testcase_04 AC 115 ms
77,008 KB
testcase_05 AC 120 ms
77,404 KB
testcase_06 AC 80 ms
76,004 KB
testcase_07 AC 98 ms
76,592 KB
testcase_08 AC 108 ms
76,668 KB
testcase_09 AC 171 ms
77,884 KB
testcase_10 AC 98 ms
76,372 KB
testcase_11 AC 83 ms
76,012 KB
testcase_12 AC 117 ms
77,120 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
NM = [list(map(int,input().split())) for i in range(n*m)]

ans = 10**10

def calc(x,y):

    if x == n-1:
        target = set([1,n,n-1,n-2,n-3])
    else:
        target = set([x-2,x-1,x,x+1,x+2])

    
    num = 0

    turn = -1
    now = 0
    while num < 5:

        turn += 1

        dif = 5-num

        for i in range(dif):
            nx,ny = NM[now]
            now += 1
            if ny == y and nx in target:
                num += 1
        
    return turn
for i in range(3,n):
    for j in range(1,m+1):
        ans = min(ans,calc(i,j))

print(ans)
0