結果
| 問題 |
No.2701 A cans -> B cans
|
| コンテスト | |
| ユーザー |
Common Lisp
|
| 提出日時 | 2024-11-13 00:12:54 |
| 言語 | Common Lisp (sbcl 2.5.0) |
| 結果 |
AC
|
| 実行時間 | 430 ms / 1,000 ms |
| コード長 | 788 bytes |
| コンパイル時間 | 481 ms |
| コンパイル使用メモリ | 35,620 KB |
| 実行使用メモリ | 22,144 KB |
| 最終ジャッジ日時 | 2024-11-13 00:13:15 |
| 合計ジャッジ時間 | 21,248 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 73 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 13 NOV 2024 12:12:54 AM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.060
ソースコード
(defun main (&rest argv)
(declare (ignorable argv))
(let* ((*read-default-float-format* 'double-float)
(n (read))
(m (read))
(dp (make-array (1+ m) :element-type 'integer :initial-element 0)))
(dotimes (_ n)
(let* ((a (read))
(b (read))
(c (read))
(d 0)
(e 0))
(dotimes (i m)
(incf e)
(when (>= e a)
(incf d b)
(incf e (- b a)))
(setf (aref dp (1+ i)) (max (aref dp (1+ i)) (* d c))))))
(loop for i from 1 to m do
(loop for j from 1 to (floor i 2) do
(setf (aref dp i) (max (aref dp i) (+ (aref dp j) (aref dp (- i j)))))))
(loop for i from 1 to m do (format t "~d~%" (aref dp i)))))
(main)
Common Lisp