結果
| 問題 | No.5 数字のブロック |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-02-04 15:00:30 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 530 bytes |
| 記録 | |
| コンパイル時間 | 90 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 832,528 KB |
| 最終ジャッジ日時 | 2024-06-30 03:58:04 |
| 合計ジャッジ時間 | 21,083 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | MLE * 15 -- * 19 |
ソースコード
# coding: utf-8
import numpy as np
L = int(input())
N = int(input())
length = [int(i) for i in input().split()]
MAX_N,MAX_L = 10000,10000
memo = -1*np.ones((MAX_N+1,MAX_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
print(memo)
return res
print(int(search(0,L)))