結果

問題 No.2375 watasou and hibit's baseball
ユーザー ikomaikoma
提出日時 2023-07-07 22:57:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,251 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 87,140 KB
実行使用メモリ 84,960 KB
最終ジャッジ日時 2023-09-29 00:33:55
合計ジャッジ時間 8,719 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,340 KB
testcase_01 AC 70 ms
71,360 KB
testcase_02 AC 72 ms
71,324 KB
testcase_03 AC 132 ms
78,280 KB
testcase_04 WA -
testcase_05 AC 71 ms
71,244 KB
testcase_06 AC 69 ms
71,256 KB
testcase_07 AC 71 ms
71,448 KB
testcase_08 AC 72 ms
71,068 KB
testcase_09 AC 71 ms
71,364 KB
testcase_10 AC 73 ms
71,540 KB
testcase_11 AC 70 ms
71,316 KB
testcase_12 AC 625 ms
84,960 KB
testcase_13 WA -
testcase_14 AC 70 ms
71,388 KB
testcase_15 AC 70 ms
71,124 KB
testcase_16 AC 71 ms
71,540 KB
testcase_17 WA -
testcase_18 AC 70 ms
71,280 KB
testcase_19 AC 70 ms
71,324 KB
testcase_20 AC 70 ms
71,324 KB
testcase_21 AC 211 ms
79,748 KB
testcase_22 AC 71 ms
71,408 KB
testcase_23 AC 70 ms
71,580 KB
testcase_24 AC 69 ms
71,328 KB
testcase_25 AC 70 ms
71,364 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 348 ms
80,616 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