結果

問題 No.496 ワープクリスタル (給料日前編)
ユーザー tsubametsubame
提出日時 2017-03-24 22:50:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 622 bytes
コンパイル時間 206 ms
コンパイル使用メモリ 10,952 KB
実行使用メモリ 12,304 KB
最終ジャッジ日時 2023-09-20 01:55:19
合計ジャッジ時間 4,111 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
12,304 KB
testcase_01 AC 14 ms
7,760 KB
testcase_02 WA -
testcase_03 AC 14 ms
7,900 KB
testcase_04 WA -
testcase_05 AC 15 ms
7,932 KB
testcase_06 WA -
testcase_07 AC 15 ms
7,884 KB
testcase_08 TLE -
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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def calc_score(c, i, x, y, max_x, max_y, score):
    if i == len(c):
        return max_x + max_y - x - y + score
    elif c[i][0] + x > max_x or c[i][1] + y > max_y:
        return calc_score(c, i+1, x, y, max_x, max_y, score)
    else:
        return min(calc_score(c, i+1, x, y, max_x, max_y, score), calc_score(c, i+1, x+c[i][0], y+c[i][1], max_x, max_y, score+c[i][2]))

X, Y, N, F = list(map(int, input().split()))
c = []

for i in range(N):
    tmp = list(map(int, input().split()))
    if (tmp[0] + tmp[1]) * F <= tmp[2]:
        continue
    c.append(tmp)

score = calc_score(c, 0, 0, 0, X, Y, 0)

print(score)


0