結果
| 問題 | No.5 数字のブロック |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-01-15 14:44:29 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 365 ms / 5,000 ms |
| + 276µs | |
| コード長 | 254 bytes |
| 記録 | |
| コンパイル時間 | 63 ms |
| コンパイル使用メモリ | 82,160 KB |
| 実行使用メモリ | 68,272 KB |
| 最終ジャッジ日時 | 2026-10-08 22:41:30 |
| 合計ジャッジ時間 | 5,803 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
l=int(input())
n=int(input())
W=list(map(int,input().split()))
DP=[-1]*(l+1)
DP[0]=0
DP[W[0]]=1
for i in range(1,n):
for j in range(l-W[i],-1,-1):
if DP[j]==-1:
continue
DP[j+W[i]]=max(DP[j+W[i]],DP[j]+1)
print(max(DP))