結果

問題 No.2375 watasou and hibit's baseball
ユーザー 👑 timitimi
提出日時 2023-07-15 02:10:46
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 927 bytes
コンパイル時間 1,241 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 781,584 KB
最終ジャッジ日時 2023-10-14 16:30:36
合計ジャッジ時間 9,803 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
71,528 KB
testcase_01 AC 89 ms
71,580 KB
testcase_02 AC 90 ms
71,576 KB
testcase_03 AC 1,204 ms
252,752 KB
testcase_04 WA -
testcase_05 AC 99 ms
76,852 KB
testcase_06 MLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,A,B=map(int, input().split())
C=[]
for i in range(N):
  x,y,k=map(int, input().split())
  C.append((x,y,k))
from collections import deque
d=deque()
dp=[[[0]*N for _ in range(N)] for i in range(2**N)]
ans=1
for i in range(N):
  for j in range(N):
    if i==j:
      continue
    x,y,k=C[j];xx,yy,kk=C[i]
    bit=2**j+2**i
    f=0
    if A<=abs(x-xx)+abs(y-yy):
      f=1
    if B<=abs(k-kk):
      f=1
    if f==1:
      dp[bit][j][i]=1
      ans=max(ans,2)
      d.append((bit,j,i))

for i in range(3,N+1):
  nd=deque()
  while d:
    bit,p,q=d.popleft()
    for j in range(N):
      if not (bit & (1<<j)):
        f=0
        bbit=bit|(1<<j)
        x,y,k=C[p];xx,yy,kk=C[q];xxx,yyy,kkk=C[j]
        if B<=abs(kk-kkk):
          f=1
        if A<=abs(x-xx)+abs(y-yy)+abs(xx-xxx)+abs(yy-yyy):
          f=1
        if f==1:
          dp[bbit][q][j]=i
          ans=max(ans,i)
          nd.append((bbit,q,j))
  d=nd
print(ans)
0