結果

問題 No.1375 Divide and Update
コンテスト
ユーザー linuxmetel
提出日時 2021-02-05 22:30:30
言語 Common Lisp
(sbcl 2.6.3)
コンパイル:
sbclc _filename_
実行:
sbcl --script Main.fasl
結果
AC  
実行時間 239 ms / 2,000 ms
コード長 1,094 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,046 ms
コンパイル使用メモリ 28,544 KB
実行使用メモリ 34,688 KB
最終ジャッジ日時 2026-03-23 21:21:46
合計ジャッジ時間 5,055 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 19
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 23 MAR 2026 09:21:34 PM):

; wrote /home/judge/data/code/Main.fasl
; compilation finished in 0:00:00.042

ソースコード

diff #
raw source code

(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)
0