結果

問題 No.2463 ストレートフラッシュ
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2023-09-08 22:47:20
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 689 bytes
コンパイル時間 591 ms
コンパイル使用メモリ 86,836 KB
実行使用メモリ 99,512 KB
最終ジャッジ日時 2023-09-08 22:47:31
合計ジャッジ時間 6,427 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
78,240 KB
testcase_01 AC 73 ms
71,120 KB
testcase_02 AC 74 ms
70,712 KB
testcase_03 AC 133 ms
75,920 KB
testcase_04 AC 122 ms
77,332 KB
testcase_05 AC 128 ms
76,988 KB
testcase_06 AC 84 ms
75,828 KB
testcase_07 AC 101 ms
76,316 KB
testcase_08 AC 112 ms
76,820 KB
testcase_09 AC 181 ms
77,808 KB
testcase_10 AC 102 ms
76,492 KB
testcase_11 AC 86 ms
75,832 KB
testcase_12 AC 124 ms
76,928 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 = [1,n,n-1,n-2,n-3]
    else:
        target = [x-2,x-1,x,x+1,x+2]

    
    num = 0

    for i in range(5):
        nx,ny = NM[i]
        if ny == y and nx in target:
            num += 1

    turn = 0
    now = 5
    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