結果

問題 No.2375 watasou and hibit's baseball
ユーザー titiatitia
提出日時 2023-07-12 04:45:18
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,088 bytes
コンパイル時間 393 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 126,340 KB
最終ジャッジ日時 2023-10-11 18:58:28
合計ジャッジ時間 38,445 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,520 KB
testcase_01 AC 72 ms
71,268 KB
testcase_02 AC 73 ms
71,364 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 TLE -
testcase_07 AC 77 ms
71,448 KB
testcase_08 WA -
testcase_09 AC 74 ms
71,228 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 74 ms
71,220 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 72 ms
71,232 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 1,724 ms
123,580 KB
testcase_25 AC 74 ms
71,324 KB
testcase_26 TLE -
testcase_27 TLE -
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
testcase_33 TLE -
testcase_34 TLE -
testcase_35 WA -
testcase_36 TLE -
testcase_37 TLE -
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):
    ko=i.bit_count()
    
    for j in range(N):

        X1,Y1,K1=LIST[j]
        
        for k in range(N):
            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