結果

問題 No.2375 watasou and hibit's baseball
ユーザー titiatitia
提出日時 2023-07-12 04:36:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,091 bytes
コンパイル時間 1,351 ms
コンパイル使用メモリ 86,756 KB
実行使用メモリ 124,668 KB
最終ジャッジ日時 2023-10-11 18:56:33
合計ジャッジ時間 41,619 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import sys
input = sys.stdin.readline

N,A,B=map(int,input().split())

LIST=[list(map(int,input().split())) for i in range(N)]

DP=[[[0]*N for j in range(N)] for i in range(1<<N)]
ANS=0
for i in range(N):
    DP[1<<i][i][i]=1

for i in range(1<<N):
    for j in range(N):

        X1,Y1,K1=LIST[j]
        
        for k in range(N):
            ko=i.bit_count()

            X2,Y2,K2=LIST[k]

            for l in range(N):
                if i & (1<<l) != 0:
                    X3,Y3,K3=LIST[l]

                    if ko==1:
                        if A<=abs(X2-X3)+abs(Y2-Y3):
                            DP[i|(1<<l)][k][l]=DP[i][j][k]+1

                    if ko>=1:
                        if B<=abs(K2-K3):
                            DP[i|(1<<l)][k][l]=DP[i][j][k]+1

                    if ko>=2:
                        if A<=abs(X2-X3)+abs(Y2-Y3) + abs(X1-X3)+abs(Y1-Y3):
                            DP[i|(1<<l)][k][l]=DP[i][j][k]+1
                        
for i in range(1<<N):
    for j in range(N):
        for k in range(N):
            ANS=max(ANS,DP[i][j][k])

print(ANS)
0