結果

問題 No.2375 watasou and hibit's baseball
ユーザー 👑 timitimi
提出日時 2023-07-15 02:24:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,545 ms / 2,000 ms
コード長 916 bytes
コンパイル時間 284 ms
コンパイル使用メモリ 87,100 KB
実行使用メモリ 210,832 KB
最終ジャッジ日時 2023-10-14 16:45:43
合計ジャッジ時間 15,295 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
71,772 KB
testcase_01 AC 82 ms
71,560 KB
testcase_02 AC 84 ms
71,568 KB
testcase_03 AC 419 ms
90,196 KB
testcase_04 AC 82 ms
71,412 KB
testcase_05 AC 92 ms
76,804 KB
testcase_06 AC 1,545 ms
210,832 KB
testcase_07 AC 85 ms
71,416 KB
testcase_08 AC 85 ms
71,756 KB
testcase_09 AC 86 ms
71,680 KB
testcase_10 AC 82 ms
71,572 KB
testcase_11 AC 83 ms
71,320 KB
testcase_12 AC 255 ms
82,500 KB
testcase_13 AC 128 ms
78,552 KB
testcase_14 AC 85 ms
71,612 KB
testcase_15 AC 509 ms
89,756 KB
testcase_16 AC 284 ms
83,008 KB
testcase_17 AC 127 ms
78,080 KB
testcase_18 AC 90 ms
71,268 KB
testcase_19 AC 89 ms
71,416 KB
testcase_20 AC 90 ms
71,704 KB
testcase_21 AC 149 ms
78,768 KB
testcase_22 AC 90 ms
71,800 KB
testcase_23 AC 89 ms
71,748 KB
testcase_24 AC 88 ms
71,812 KB
testcase_25 AC 88 ms
71,800 KB
testcase_26 AC 523 ms
99,920 KB
testcase_27 AC 673 ms
106,912 KB
testcase_28 AC 646 ms
110,520 KB
testcase_29 AC 642 ms
119,876 KB
testcase_30 AC 872 ms
132,156 KB
testcase_31 AC 867 ms
127,120 KB
testcase_32 AC 1,002 ms
138,372 KB
testcase_33 AC 667 ms
109,924 KB
testcase_34 AC 505 ms
102,080 KB
testcase_35 AC 743 ms
132,240 KB
testcase_36 AC 614 ms
121,468 KB
testcase_37 AC 498 ms
105,968 KB
testcase_38 AC 97 ms
77,032 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=q*100+j
          if (bbit,cc) not in D:
            D[(bbit,cc)]=1
            nd.append((bbit,q,j))
  d=nd
print(ans)
0