結果

問題 No.2375 watasou and hibit's baseball
ユーザー 2000 Ekiben2000 Ekiben
提出日時 2023-07-08 09:03:57
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 897 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 86,964 KB
実行使用メモリ 84,232 KB
最終ジャッジ日時 2023-09-29 10:19:59
合計ジャッジ時間 4,238 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

from itertools import permutations

def max_balls(N, A, B, balls):
    max_count = 0
    for perm in permutations(range(N)):
        count = 1
        for i in range(1, N):
            if i == 1:
                if abs(balls[perm[i]][0] - balls[perm[i-1]][0]) + abs(balls[perm[i]][1] - balls[perm[i-1]][1]) >= A:
                    count += 1
            elif i >= 2:
                if abs(balls[perm[i]][2] - balls[perm[i-1]][2]) >= B or abs(balls[perm[i]][0] - balls[perm[i-1]][0]) + abs(balls[perm[i]][1] - balls[perm[i-1]][1]) + abs(balls[perm[i]][0] - balls[perm[i-2]][0]) + abs(balls[perm[i]][1] - balls[perm[i-2]][1]) >= A:
                    count += 1
        max_count = max(max_count, count)
    return max_count

N, A, B = map(int, input().split())
balls = []
for _ in range(N):
    x, y, k = map(int, input().split())
    balls.append((x, y, k))

print(max_balls(N, A, B, balls))

0