結果
問題 | No.5 数字のブロック |
ユーザー |
|
提出日時 | 2018-02-04 14:44:27 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 467 bytes |
コンパイル時間 | 68 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 825,256 KB |
最終ジャッジ日時 | 2024-06-30 03:56:07 |
合計ジャッジ時間 | 26,500 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 WA * 5 RE * 15 MLE * 2 |
ソースコード
# coding: utf-8import numpy as npL = 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 = 0elif 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] = resreturn resprint(search(0,L))