結果

問題 No.37 遊園地のアトラクション
ユーザー ゆるくゆるく
提出日時 2015-05-06 04:57:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 727 bytes
コンパイル時間 1,269 ms
コンパイル使用メモリ 10,816 KB
実行使用メモリ 10,808 KB
最終ジャッジ日時 2023-09-19 07:07:39
合計ジャッジ時間 9,218 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
10,772 KB
testcase_01 AC 36 ms
10,364 KB
testcase_02 AC 151 ms
10,360 KB
testcase_03 AC 218 ms
10,668 KB
testcase_04 AC 102 ms
10,484 KB
testcase_05 AC 160 ms
10,364 KB
testcase_06 AC 132 ms
10,780 KB
testcase_07 AC 625 ms
10,808 KB
testcase_08 AC 89 ms
10,416 KB
testcase_09 AC 49 ms
10,408 KB
testcase_10 AC 512 ms
10,600 KB
testcase_11 AC 488 ms
10,632 KB
testcase_12 AC 148 ms
10,492 KB
testcase_13 AC 202 ms
10,568 KB
testcase_14 AC 99 ms
10,440 KB
testcase_15 WA -
testcase_16 AC 290 ms
10,700 KB
testcase_17 AC 250 ms
10,740 KB
testcase_18 AC 607 ms
10,668 KB
testcase_19 AC 48 ms
10,436 KB
testcase_20 AC 222 ms
10,524 KB
testcase_21 AC 107 ms
10,740 KB
testcase_22 AC 915 ms
10,552 KB
testcase_23 AC 33 ms
10,436 KB
testcase_24 AC 34 ms
10,608 KB
testcase_25 AC 33 ms
10,424 KB
testcase_26 AC 33 ms
10,352 KB
testcase_27 WA -
testcase_28 AC 34 ms
10,608 KB
testcase_29 AC 90 ms
10,376 KB
testcase_30 AC 34 ms
10,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

t = int(input())
n = int(input())
ct = deque(map(int, input().split()))
vt = deque(map(int, input().split()))

dp = [0] * 20001
c = [0] * 2000
v = [0] * 2000
for i in range(len(ct)):
    c[i] = ct[i]
    v[i] = vt[i]
p = n
for i in range(n):
    j = c[i]
    k = v[i]
    while(1):
        k = k // 2
        if k == 0:
            break
        c[p] = j
        v[p] = k
        p += 1
for i in range(p):
    for j in reversed(range(t - c[i])):
        dp[j + c[i]] = max(dp[j + c[i]], dp[j] + v[i])
print(dp[t - 1])
0