結果

問題 No.2375 watasou and hibit's baseball
ユーザー ntudantuda
提出日時 2023-07-12 20:31:26
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 1,240 bytes
コンパイル時間 1,103 ms
コンパイル使用メモリ 86,832 KB
実行使用メモリ 847,396 KB
最終ジャッジ日時 2023-10-12 10:46:03
合計ジャッジ時間 5,875 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,328 KB
testcase_01 AC 74 ms
71,268 KB
testcase_02 AC 74 ms
71,308 KB
testcase_03 AC 456 ms
170,172 KB
testcase_04 AC 75 ms
71,448 KB
testcase_05 AC 79 ms
76,232 KB
testcase_06 MLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,A,B = map(int,input().split())
XYK = [list(map(int,input().split())) for _ in range(N)]
BN = 1 << N
dp = [[[False] * (BN) for _ in range(N+1)] for _ in range(N+1)]


def dist(a,b):
    return abs(XYK[a][0] - XYK[b][0]) + abs(XYK[a][1] - XYK[b][1])

def bit_count(x):
    cnt = 0
    while x > 0:
        if x & 1:
            cnt += 1
        x >>= 1
    return cnt

q = []
cnt = 1
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        if B <= abs(XYK[i][2]- XYK[j][2]) or A < dist(i,j):
            cnt = 2
            tmp = (1<<i)|(1<<j)
            q.append((i,j,tmp))


Pass = [[[False] * N for _ in range(N)]  for _ in range(N)]
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        for k in range(N):
            if i == k or j == k:
                continue
            if B <= abs(XYK[j][2]- XYK[k][2]) or A <= dist(k,i)+dist(k,j):
                Pass[i][j][k] = True
                #print(i,j,k)

q2 = []
while q:
    while q:
        a,b,c = q.pop(-1)
        for i in range(N):
            if c & (1 << i) == 0:
                if Pass[a][b][i]:
                    q2.append((b,i,c|(1<<i)))

    if q2:
        cnt += 1
    q,q2 = q2,q

print(cnt)




0