結果

問題 No.37 遊園地のアトラクション
ユーザー ゆるくゆるく
提出日時 2015-05-06 05:29:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 875 ms / 5,000 ms
コード長 718 bytes
コンパイル時間 423 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-04-18 19:34:12
合計ジャッジ時間 7,478 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
12,288 KB
testcase_01 AC 34 ms
11,904 KB
testcase_02 AC 158 ms
12,032 KB
testcase_03 AC 215 ms
12,288 KB
testcase_04 AC 104 ms
12,032 KB
testcase_05 AC 156 ms
12,032 KB
testcase_06 AC 131 ms
12,160 KB
testcase_07 AC 676 ms
12,416 KB
testcase_08 AC 93 ms
12,288 KB
testcase_09 AC 49 ms
12,160 KB
testcase_10 AC 498 ms
12,160 KB
testcase_11 AC 500 ms
12,416 KB
testcase_12 AC 149 ms
12,160 KB
testcase_13 AC 213 ms
12,288 KB
testcase_14 AC 100 ms
12,032 KB
testcase_15 AC 119 ms
12,160 KB
testcase_16 AC 301 ms
12,160 KB
testcase_17 AC 253 ms
12,288 KB
testcase_18 AC 620 ms
12,160 KB
testcase_19 AC 50 ms
12,032 KB
testcase_20 AC 216 ms
12,032 KB
testcase_21 AC 116 ms
12,160 KB
testcase_22 AC 875 ms
12,288 KB
testcase_23 AC 36 ms
12,032 KB
testcase_24 AC 32 ms
11,904 KB
testcase_25 AC 33 ms
12,032 KB
testcase_26 AC 35 ms
12,032 KB
testcase_27 AC 129 ms
12,160 KB
testcase_28 AC 34 ms
12,032 KB
testcase_29 AC 85 ms
12,160 KB
testcase_30 AC 32 ms
12,032 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 = list(map(int, input().split()))
vt = list(map(int, input().split()))

dp = [0] * 20001
c = [0] * 2000
v = [0] * 2000
for i in range(n):
    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 + 1 - c[i])):
        dp[j + c[i]] = max(dp[j + c[i]], dp[j] + v[i])
print(dp[t])
0