結果

問題 No.2375 watasou and hibit's baseball
ユーザー 👑 timitimi
提出日時 2023-07-15 02:21:43
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 877 bytes
コンパイル時間 1,115 ms
コンパイル使用メモリ 87,216 KB
実行使用メモリ 311,204 KB
最終ジャッジ日時 2023-10-14 16:42:35
合計ジャッジ時間 17,421 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
71,432 KB
testcase_01 AC 81 ms
71,592 KB
testcase_02 AC 81 ms
71,760 KB
testcase_03 AC 350 ms
93,744 KB
testcase_04 AC 76 ms
71,704 KB
testcase_05 AC 85 ms
76,932 KB
testcase_06 TLE -
testcase_07 AC 135 ms
71,364 KB
testcase_08 AC 78 ms
71,716 KB
testcase_09 AC 77 ms
71,556 KB
testcase_10 AC 75 ms
71,680 KB
testcase_11 AC 76 ms
71,292 KB
testcase_12 AC 219 ms
81,068 KB
testcase_13 AC 117 ms
78,940 KB
testcase_14 AC 77 ms
71,628 KB
testcase_15 AC 352 ms
92,876 KB
testcase_16 AC 280 ms
88,340 KB
testcase_17 AC 116 ms
77,916 KB
testcase_18 AC 80 ms
71,428 KB
testcase_19 AC 83 ms
71,712 KB
testcase_20 AC 78 ms
71,460 KB
testcase_21 AC 134 ms
78,416 KB
testcase_22 AC 78 ms
71,636 KB
testcase_23 AC 80 ms
71,708 KB
testcase_24 AC 81 ms
71,268 KB
testcase_25 AC 79 ms
71,556 KB
testcase_26 AC 403 ms
115,360 KB
testcase_27 AC 522 ms
132,208 KB
testcase_28 AC 538 ms
151,352 KB
testcase_29 AC 618 ms
195,232 KB
testcase_30 AC 768 ms
208,832 KB
testcase_31 AC 712 ms
182,416 KB
testcase_32 AC 920 ms
245,616 KB
testcase_33 AC 549 ms
145,556 KB
testcase_34 AC 416 ms
125,416 KB
testcase_35 AC 775 ms
225,052 KB
testcase_36 AC 646 ms
196,688 KB
testcase_37 AC 476 ms
142,200 KB
testcase_38 AC 90 ms
77,140 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=[]
  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)
          D.append((bbit,q,j))
  d=deque()
  D=set(D)
  for a,b,c in D:
    d.append((a,b,c))
print(ans)
0