結果
| 問題 |
No.5 数字のブロック
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-02-04 14:45:23 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 472 bytes |
| コンパイル時間 | 243 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 820,160 KB |
| 最終ジャッジ日時 | 2024-06-30 03:56:37 |
| 合計ジャッジ時間 | 28,067 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 RE * 15 MLE * 2 |
ソースコード
# coding: utf-8
import numpy as np
L = int(input())
N = int(input())
length = [int(i) for i in input().split()]
memo = -1*np.ones((N+1,L+1))
def search(i,j):
if memo[i,j] != -1:
return memo[i,j]
else:
if i == N:
res = 0
elif j < length[i]:
res = search(i+1,j)
else:
res = max(search(i+1, j), search(i+1, j - length[i]) + 1)
memo[i,j] = res
return res
print(int(search(0,L)))