結果

問題 No.2375 watasou and hibit's baseball
ユーザー 👑 timitimi
提出日時 2023-07-15 02:19:03
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 828 bytes
コンパイル時間 1,066 ms
コンパイル使用メモリ 87,024 KB
実行使用メモリ 732,008 KB
最終ジャッジ日時 2023-10-14 16:39:40
合計ジャッジ時間 6,090 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
71,644 KB
testcase_01 AC 90 ms
71,564 KB
testcase_02 AC 89 ms
71,448 KB
testcase_03 AC 764 ms
157,308 KB
testcase_04 AC 92 ms
71,540 KB
testcase_05 AC 98 ms
76,724 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()
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:
      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-xxx)+abs(y-yyy)+abs(xx-xxx)+abs(yy-yyy):
          f=1
        if f==1:
          ans=max(ans,i)
          nd.append((bbit,q,j))
  d=nd
print(ans)
0