結果

問題 No.2375 watasou and hibit's baseball
ユーザー sasa8uyauyasasa8uyauya
提出日時 2024-03-23 11:37:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 989 ms / 2,000 ms
コード長 688 bytes
コンパイル時間 390 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 125,080 KB
最終ジャッジ日時 2024-03-23 11:37:47
合計ジャッジ時間 13,811 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 37 ms
53,460 KB
testcase_02 AC 39 ms
53,460 KB
testcase_03 AC 488 ms
100,112 KB
testcase_04 AC 42 ms
59,836 KB
testcase_05 AC 45 ms
59,580 KB
testcase_06 AC 989 ms
125,012 KB
testcase_07 AC 37 ms
53,460 KB
testcase_08 AC 80 ms
84,124 KB
testcase_09 AC 38 ms
53,460 KB
testcase_10 AC 38 ms
53,460 KB
testcase_11 AC 51 ms
66,344 KB
testcase_12 AC 331 ms
121,272 KB
testcase_13 AC 145 ms
95,268 KB
testcase_14 AC 37 ms
53,460 KB
testcase_15 AC 374 ms
84,344 KB
testcase_16 AC 344 ms
81,484 KB
testcase_17 AC 209 ms
119,068 KB
testcase_18 AC 40 ms
53,460 KB
testcase_19 AC 40 ms
53,460 KB
testcase_20 AC 50 ms
66,344 KB
testcase_21 AC 217 ms
119,580 KB
testcase_22 AC 37 ms
53,460 KB
testcase_23 AC 160 ms
116,636 KB
testcase_24 AC 157 ms
116,764 KB
testcase_25 AC 36 ms
53,460 KB
testcase_26 AC 544 ms
124,548 KB
testcase_27 AC 601 ms
124,416 KB
testcase_28 AC 581 ms
124,328 KB
testcase_29 AC 612 ms
123,768 KB
testcase_30 AC 634 ms
124,028 KB
testcase_31 AC 684 ms
125,080 KB
testcase_32 AC 715 ms
124,840 KB
testcase_33 AC 600 ms
124,356 KB
testcase_34 AC 572 ms
123,912 KB
testcase_35 AC 719 ms
124,836 KB
testcase_36 AC 597 ms
123,400 KB
testcase_37 AC 464 ms
122,080 KB
testcase_38 AC 168 ms
116,892 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,a,b=map(int,input().split())
ball=[tuple(map(int,input().split())) for i in range(n)]
g=1
q=[[[0]*n for j in range(n)] for i in range(1<<n)]
for i in range(n):
	for j in range(n):
		if i!=j:
			x1,y1,k1=ball[i]
			x2,y2,k2=ball[j]
			if a<=abs(x1-x2)+abs(y1-y2) or b<=abs(k1-k2):
				q[(1<<i)+(1<<j)][i][j]=2
				g=2
for p in range(1<<n):
	for i in range(n):
		for j in range(n):
			if q[p][i][j]>0:
				x1,y1,k1=ball[i]
				x2,y2,k2=ball[j]
				for k in range(n):
					if (p>>k)&1==0:
						x3,y3,k3=ball[k]
						if a<=abs(x3-x1)+abs(y3-y1)+abs(x3-x2)+abs(y3-y2) or b<=abs(k3-k1):
							q[p+(1<<k)][k][i]=max(q[p+(1<<k)][k][i],q[p][i][j]+1)
							g=max(g,q[p+(1<<k)][k][i])
print(g)
0