結果

問題 No.2375 watasou and hibit's baseball
ユーザー ikomaikoma
提出日時 2023-07-07 22:57:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,251 bytes
コンパイル時間 273 ms
コンパイル使用メモリ 11,064 KB
実行使用メモリ 12,780 KB
最終ジャッジ日時 2023-09-29 00:34:23
合計ジャッジ時間 6,817 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,288 KB
testcase_01 AC 17 ms
8,284 KB
testcase_02 AC 17 ms
8,384 KB
testcase_03 AC 26 ms
8,256 KB
testcase_04 WA -
testcase_05 AC 17 ms
8,380 KB
testcase_06 AC 17 ms
8,284 KB
testcase_07 AC 16 ms
8,280 KB
testcase_08 AC 17 ms
8,288 KB
testcase_09 AC 16 ms
8,280 KB
testcase_10 AC 16 ms
8,316 KB
testcase_11 AC 17 ms
8,280 KB
testcase_12 AC 1,058 ms
8,368 KB
testcase_13 WA -
testcase_14 AC 16 ms
8,232 KB
testcase_15 AC 16 ms
8,324 KB
testcase_16 AC 16 ms
8,204 KB
testcase_17 WA -
testcase_18 AC 16 ms
8,308 KB
testcase_19 AC 16 ms
8,320 KB
testcase_20 AC 16 ms
8,236 KB
testcase_21 AC 70 ms
8,308 KB
testcase_22 AC 16 ms
8,248 KB
testcase_23 AC 16 ms
8,260 KB
testcase_24 AC 16 ms
8,228 KB
testcase_25 AC 16 ms
8,288 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 553 ms
8,412 KB
testcase_29 TLE -
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)]
visit = [0]*N
def dfs(route:list):
    ret = len(route)
    for i in range(N):
        if visit[i]:continue
        x,y,k=XYK[i]
        i0,i1 = route[-2:]
        x1,y1,k1=XYK[i1]
        flg=0
        if abs(k-k1)>=B:
            flg=1
        else:
            x0,y0,_=XYK[i0]
            if A<=abs(x0-x1)+abs(y0-y1)+abs(y1-y)+abs(x1-x):
                flg=1
        if flg:
            route.append(i)
            visit[i]=1
            ret2 = dfs(route)
            visit[i]=0
            route.pop()
            ret = max(ret, ret2)
    if ret==N:
        print(N)
        exit()
    return ret

def solve():
    ret = 1
    route = []
    for i in range(N):
        route.append(i)
        x1,y1,k1 = XYK[i]
        visit[i]=1
        for j in range(N):
            if i==j:continue
            x2,y2,k2 = XYK[j]
            if A<=abs(x1-x2)+abs(y1-y2) or B<=abs(k1-k2):
                if ret==1:ret=2
                route.append(j)
                visit[j]=1
                ret2 = dfs(route)
                ret = max(ret, ret2)
                route.pop()
                visit[j]=0
        visit[i]=0
        route.pop()

    return ret
print(solve())
0