結果
| 問題 |
No.1375 Divide and Update
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-02-05 22:30:30 |
| 言語 | Common Lisp (sbcl 2.5.0) |
| 結果 |
AC
|
| 実行時間 | 520 ms / 2,000 ms |
| コード長 | 1,094 bytes |
| コンパイル時間 | 1,042 ms |
| コンパイル使用メモリ | 37,400 KB |
| 実行使用メモリ | 36,224 KB |
| 最終ジャッジ日時 | 2024-07-02 13:03:59 |
| 合計ジャッジ時間 | 7,595 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 19 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 02 JUL 2024 01:03:49 PM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.028
ソースコード
(defvar n (read))
(defvar x (read))
(defvar y (read))
(defvar a (loop repeat n
collect (read)))
(defvar s (apply #'+ a))
(defvar ax (apply #'vector (let ((m #.DOUBLE-FLOAT-NEGATIVE-INFINITY)
(b #.DOUBLE-FLOAT-NEGATIVE-INFINITY))
(loop for i in a
do (setq b (max (- x i) (+ b (- x i)))
m (max m b))
collect m))))
(defvar bx (nreverse (apply #'vector (let ((m #.DOUBLE-FLOAT-NEGATIVE-INFINITY)
(b #.DOUBLE-FLOAT-NEGATIVE-INFINITY))
(loop for i in (nreverse a)
do (setq b (max (- y i) (+ b (- y i)))
m (max m b))
collect m)))))
(loop for m from 1 to (- n 2)
do (princ (+ s (aref ax (1- m)) (aref bx (1+ m))))
(fresh-line))
;(princ ax)
;(princ bx)
;(princ s)