結果
| 問題 | No.247 線形計画問題もどき |
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2022-08-17 04:20:06 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
MLE
不安定
|
| 実行時間 | - |
| コード長 | 444 bytes |
| 記録 | |
| コンパイル時間 | 127 ms |
| コンパイル使用メモリ | 82,416 KB |
| 実行使用メモリ | 1,337,420 KB |
| 最終ジャッジ日時 | 2026-09-09 22:13:37 |
| 合計ジャッジ時間 | 4,381 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | MLE * 1 -- * 4 |
| other | AC * 2 MLE * 1 -- * 20 |
ソースコード
from collections import deque
C=int(input())
N=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)
Q=deque()
Q.append((0,0,C))# 回数, index, rest
ANS=1<<31
while Q:
s,ind,rest=Q.popleft()
if rest==0:
ANS=min(ANS,s)
continue
if ind<N:
x=rest//A[ind]
for i in range(x+1):
Q.append((s+i,ind+1,rest-i*A[ind]))
if ANS==1<<31:
print(-1)
else:
print(ANS)
titia