結果

問題 No.2375 watasou and hibit's baseball
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2023-07-07 23:27:24
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,013 bytes
コンパイル時間 313 ms
コンパイル使用メモリ 87,040 KB
実行使用メモリ 105,884 KB
最終ジャッジ日時 2023-09-29 01:11:04
合計ジャッジ時間 12,844 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,204 KB
testcase_01 AC 74 ms
71,440 KB
testcase_02 AC 80 ms
71,196 KB
testcase_03 AC 346 ms
88,564 KB
testcase_04 WA -
testcase_05 AC 87 ms
76,300 KB
testcase_06 AC 639 ms
102,472 KB
testcase_07 AC 76 ms
71,028 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 667 ms
102,772 KB
testcase_13 WA -
testcase_14 AC 74 ms
71,288 KB
testcase_15 AC 136 ms
79,376 KB
testcase_16 AC 113 ms
78,012 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 76 ms
71,404 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 332 ms
104,852 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n,a,b = map(int,input().split())
XYK = [list(map(int,input().split())) for i in range(n)]

dp = [[[0]*(1<<n) for i in range(n)] for j in range(n)]
for i in range(n):
    dp[i][0][1<<i] = 1

ans = 0

for b in range(1<<n):
    for i in range(n):
        for j in range(n):
            if dp[i][j][b] == 0:
                continue

            num = bin(b).count("1")
            ans = max(ans,num)
            x1,y1,k1 = XYK[i]
            x2,y2,k2 = XYK[j]

            for k in range(n):
                if b >> k & 1:
                    continue
                x3,y3,k3 = XYK[k]
                if num == 1:
                    if abs(x1-x3)+abs(y1-y3) >= a:
                        dp[k][i][b|1<<k] = 1
                        continue

                if abs(k1-k3) >= b:
                    dp[k][i][b|1<<k] = 1
                    continue

                if num >= 2 and abs(x1-x3)+abs(y1-y3) + abs(x2-x3)+abs(y2-y3) >= a:
                    dp[k][i][b|1<<k] = 1
                    continue
print(ans)
0