結果
| 問題 |
No.31 悪のミックスジュース
|
| コンテスト | |
| ユーザー |
Common Lisp
|
| 提出日時 | 2024-11-10 21:48:13 |
| 言語 | Common Lisp (sbcl 2.5.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,147 bytes |
| コンパイル時間 | 495 ms |
| コンパイル使用メモリ | 30,080 KB |
| 実行使用メモリ | 22,016 KB |
| 最終ジャッジ日時 | 2024-11-10 21:48:15 |
| 合計ジャッジ時間 | 1,706 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 15 WA * 2 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 10 NOV 2024 09:48:13 PM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.016
ソースコード
(defconstant +inf+ 987654321987654321)
(defun main (&rest argv)
(declare (ignorable argv))
(let* ((n (read))
(v (read))
(k 1)
(c (make-array 101 :element-type 'integer :initial-element 0))
(dp (make-array 10001 :element-type 'integer))
(res +inf+))
(loop for i from 1 to n do
(setf (aref c i) (read)
(aref c i) (+ (aref c i) (aref c (- i 1)))))
(loop for i from 2 to n
when (> (* (aref c k) i) (* (aref c i) k))
do (setq k i))
(loop for i from 1 to 10000 do
(setf (aref dp i) +inf+)
(loop for j from 1 to n
when (and (>= i j) (> (aref dp i) (+ (aref dp (- i j)) (aref c j))))
do (setf (aref dp i) (+ (aref dp (- i j)) (aref c j)))))
(decf v n)
(when (<= v 0)
(setq res (aref c n)))
(loop for i to 10000
when (<= i v)
do (let* ((r (floor (+ v k -1 (- i)) k))
(w (+ (aref c n) (aref dp i) (* r (aref c k)))))
(when (> res w)
(setq res w))))
(format t "~d~%" res)))
(main)
Common Lisp