結果

問題 No.2375 watasou and hibit's baseball
ユーザー 👑 timitimi
提出日時 2023-07-15 02:26:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,309 ms / 2,000 ms
コード長 918 bytes
コンパイル時間 1,749 ms
コンパイル使用メモリ 87,044 KB
実行使用メモリ 179,816 KB
最終ジャッジ日時 2023-10-14 16:48:21
合計ジャッジ時間 14,565 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
71,400 KB
testcase_01 AC 84 ms
71,588 KB
testcase_02 AC 86 ms
71,400 KB
testcase_03 AC 340 ms
85,368 KB
testcase_04 AC 85 ms
71,444 KB
testcase_05 AC 90 ms
76,564 KB
testcase_06 AC 1,309 ms
179,816 KB
testcase_07 AC 84 ms
71,564 KB
testcase_08 AC 82 ms
71,248 KB
testcase_09 AC 84 ms
71,248 KB
testcase_10 AC 83 ms
71,516 KB
testcase_11 AC 84 ms
71,404 KB
testcase_12 AC 238 ms
81,000 KB
testcase_13 AC 121 ms
78,440 KB
testcase_14 AC 81 ms
71,572 KB
testcase_15 AC 422 ms
86,428 KB
testcase_16 AC 237 ms
81,668 KB
testcase_17 AC 115 ms
77,924 KB
testcase_18 AC 92 ms
71,400 KB
testcase_19 AC 85 ms
71,304 KB
testcase_20 AC 87 ms
71,640 KB
testcase_21 AC 145 ms
78,168 KB
testcase_22 AC 87 ms
71,404 KB
testcase_23 AC 83 ms
71,388 KB
testcase_24 AC 83 ms
71,620 KB
testcase_25 AC 81 ms
71,656 KB
testcase_26 AC 431 ms
92,260 KB
testcase_27 AC 548 ms
99,320 KB
testcase_28 AC 510 ms
103,024 KB
testcase_29 AC 503 ms
110,596 KB
testcase_30 AC 689 ms
113,560 KB
testcase_31 AC 680 ms
113,176 KB
testcase_32 AC 767 ms
123,664 KB
testcase_33 AC 609 ms
101,636 KB
testcase_34 AC 413 ms
94,944 KB
testcase_35 AC 616 ms
118,080 KB
testcase_36 AC 539 ms
110,316 KB
testcase_37 AC 409 ms
96,352 KB
testcase_38 AC 96 ms
77,012 KB
権限があれば一括ダウンロードができます

ソースコード

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):
  D={};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)
          cc=(10**12)*(q*100+j)+bbit
          if cc not in D:
            D[cc]=1
            nd.append((bbit,q,j))
  d=nd
print(ans)
0