結果
問題 |
No.5 数字のブロック
|
ユーザー |
|
提出日時 | 2018-02-04 15:11:33 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 407 bytes |
コンパイル時間 | 80 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 414,532 KB |
最終ジャッジ日時 | 2024-06-30 03:57:09 |
合計ジャッジ時間 | 8,602 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 TLE * 1 -- * 30 |
ソースコード
# coding: utf-8 import numpy as np L = int(input()) N = int(input()) length = [int(i) for i in input().split()] dp = -1*np.ones((N+1,L+1)) for l in range(L+1): dp[N][l] = 0 i = N - 1 while i > -1: for l in range(L+1): if l < length[i]: dp[i][l] = dp[i+1][l] else: dp[i][l] = max(dp[i+1][l], dp[i+1][l - length[i]] + 1) i = i - 1 print(int(dp[0][L]))