結果

問題 No.2375 watasou and hibit's baseball
ユーザー ニックネームニックネーム
提出日時 2023-07-07 22:24:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 705 ms / 2,000 ms
コード長 648 bytes
コンパイル時間 1,433 ms
コンパイル使用メモリ 86,928 KB
実行使用メモリ 126,084 KB
最終ジャッジ日時 2023-09-28 23:50:24
合計ジャッジ時間 14,837 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,408 KB
testcase_01 AC 75 ms
71,220 KB
testcase_02 AC 76 ms
71,092 KB
testcase_03 AC 437 ms
100,520 KB
testcase_04 AC 82 ms
75,952 KB
testcase_05 AC 82 ms
75,828 KB
testcase_06 AC 705 ms
124,052 KB
testcase_07 AC 75 ms
70,924 KB
testcase_08 AC 109 ms
84,828 KB
testcase_09 AC 74 ms
71,188 KB
testcase_10 AC 73 ms
71,044 KB
testcase_11 AC 88 ms
76,204 KB
testcase_12 AC 470 ms
124,904 KB
testcase_13 AC 226 ms
98,028 KB
testcase_14 AC 74 ms
70,920 KB
testcase_15 AC 386 ms
85,980 KB
testcase_16 AC 201 ms
80,624 KB
testcase_17 AC 259 ms
121,252 KB
testcase_18 AC 76 ms
71,408 KB
testcase_19 AC 74 ms
71,216 KB
testcase_20 AC 86 ms
76,212 KB
testcase_21 AC 310 ms
122,472 KB
testcase_22 AC 75 ms
71,068 KB
testcase_23 AC 191 ms
116,820 KB
testcase_24 AC 197 ms
117,080 KB
testcase_25 AC 74 ms
71,344 KB
testcase_26 AC 470 ms
123,692 KB
testcase_27 AC 528 ms
124,772 KB
testcase_28 AC 519 ms
124,260 KB
testcase_29 AC 485 ms
122,868 KB
testcase_30 AC 648 ms
124,828 KB
testcase_31 AC 616 ms
125,728 KB
testcase_32 AC 670 ms
124,772 KB
testcase_33 AC 581 ms
124,952 KB
testcase_34 AC 485 ms
124,748 KB
testcase_35 AC 562 ms
123,936 KB
testcase_36 AC 480 ms
122,784 KB
testcase_37 AC 595 ms
126,084 KB
testcase_38 AC 213 ms
120,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,a,b = map(int,input().split())
xyk = [tuple(map(int,input().split())) for _ in range(n)]
def dist(i,j): return abs(xyk[i][0]-xyk[j][0])+abs(xyk[i][1]-xyk[j][1])
def fast(i,j): return abs(xyk[i][2]-xyk[j][2])
dp = [[[0]*n for _ in range(n)] for _ in range(1<<n)]; ans = 1
for i in range(n): dp[1<<i][i][i] = 1
for s in range(1<<n):
    for i in range(n):
        for j in range(n):
            if not dp[s][i][j]: continue
            for k in range(n):
                if s>>k&1: continue
                if fast(k,j)>=b or dist(k,j)+(i!=j)*dist(k,i)>=a: dp[s^1<<k][j][k] = dp[s][i][j]+1
                ans = max(ans,dp[s^1<<k][j][k])
print(ans)
0