結果

問題 No.1375 Divide and Update
ユーザー linuxmetellinuxmetel
提出日時 2021-02-05 22:30:30
言語 Common Lisp
(sbcl 2.3.8)
結果
AC  
実行時間 612 ms / 2,000 ms
コード長 1,094 bytes
コンパイル時間 855 ms
コンパイル使用メモリ 29,276 KB
実行使用メモリ 45,832 KB
最終ジャッジ日時 2023-09-15 08:56:52
合計ジャッジ時間 8,739 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
27,004 KB
testcase_01 AC 7 ms
22,904 KB
testcase_02 AC 8 ms
22,832 KB
testcase_03 AC 8 ms
22,932 KB
testcase_04 AC 8 ms
24,936 KB
testcase_05 AC 8 ms
22,932 KB
testcase_06 AC 8 ms
22,916 KB
testcase_07 AC 7 ms
22,900 KB
testcase_08 AC 8 ms
22,936 KB
testcase_09 AC 7 ms
22,840 KB
testcase_10 AC 520 ms
43,800 KB
testcase_11 AC 476 ms
37,248 KB
testcase_12 AC 264 ms
32,584 KB
testcase_13 AC 219 ms
31,896 KB
testcase_14 AC 592 ms
45,376 KB
testcase_15 AC 583 ms
42,456 KB
testcase_16 AC 595 ms
45,832 KB
testcase_17 AC 589 ms
41,744 KB
testcase_18 AC 611 ms
41,696 KB
testcase_19 AC 612 ms
41,740 KB
testcase_20 AC 439 ms
41,744 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 15 SEP 2023 08:56:42 AM):
; processing (DEFVAR N ...)
; processing (DEFVAR X ...)
; processing (DEFVAR Y ...)
; processing (DEFVAR A ...)
; processing (DEFVAR S ...)
; processing (DEFVAR AX ...)
; processing (DEFVAR BX ...)
; processing (LOOP FOR ...)

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

ソースコード

diff #

(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