結果
問題 |
No.2463 ストレートフラッシュ
|
ユーザー |
|
提出日時 | 2023-09-08 22:47:20 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 689 bytes |
コンパイル時間 | 329 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 99,968 KB |
最終ジャッジ日時 | 2024-06-26 16:01:45 |
合計ジャッジ時間 | 5,091 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 TLE * 1 -- * 11 |
ソースコード
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)