結果

問題 No.2463 ストレートフラッシュ
ユーザー ゼットゼット
提出日時 2023-09-08 21:54:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 746 ms / 2,000 ms
コード長 524 bytes
コンパイル時間 328 ms
コンパイル使用メモリ 86,736 KB
実行使用メモリ 124,784 KB
最終ジャッジ日時 2023-09-08 21:54:15
合計ジャッジ時間 10,157 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,024 KB
testcase_01 AC 72 ms
71,260 KB
testcase_02 AC 71 ms
71,376 KB
testcase_03 AC 109 ms
76,752 KB
testcase_04 AC 98 ms
76,968 KB
testcase_05 AC 99 ms
77,008 KB
testcase_06 AC 73 ms
71,348 KB
testcase_07 AC 97 ms
76,764 KB
testcase_08 AC 99 ms
76,952 KB
testcase_09 AC 102 ms
76,992 KB
testcase_10 AC 92 ms
76,924 KB
testcase_11 AC 75 ms
71,176 KB
testcase_12 AC 96 ms
76,924 KB
testcase_13 AC 482 ms
108,692 KB
testcase_14 AC 549 ms
113,724 KB
testcase_15 AC 544 ms
111,908 KB
testcase_16 AC 595 ms
115,360 KB
testcase_17 AC 636 ms
120,392 KB
testcase_18 AC 700 ms
123,836 KB
testcase_19 AC 680 ms
123,616 KB
testcase_20 AC 746 ms
123,644 KB
testcase_21 AC 497 ms
113,224 KB
testcase_22 AC 500 ms
124,784 KB
testcase_23 AC 529 ms
124,708 KB
testcase_24 AC 595 ms
124,664 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
v=[[[] for i in range(N+1)] for j in range(M+1)]
for i in range(N*M):
  n,m=map(int,input().split())
  l=n-4
  if l<=0:
    l=1
  for x in range(l,n+1):
    v[m][x].append(i+1)
  if n==1:
    v[m][N-3].append(i+1)
result=10**9
for i in range(1,M+1):
  for j in range(1,N-2):
    a,b,c,d,e=v[i][j][:]
    count=0
    x=0
    for k in range(5):
      a=v[i][j][k]
      if a<=x:
        continue
      e=(a-x+4-k)//(5-k)
      x+=e*(5-k)
      count+=e
    result=min(result,count-1)
print(result)
0