結果

問題 No.33 アメーバがたくさん
ユーザー Common Lisp
提出日時 2024-11-12 19:35:40
言語 Common Lisp
(sbcl 2.5.0)
結果
AC  
実行時間 11 ms / 5,000 ms
コード長 726 bytes
コンパイル時間 509 ms
コンパイル使用メモリ 39,580 KB
実行使用メモリ 29,988 KB
最終ジャッジ日時 2024-11-12 19:35:42
合計ジャッジ時間 1,608 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 12 NOV 2024 07:35:40 PM):

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

ソースコード

diff #

(defun main (&rest argv)
  (declare (ignorable argv))
  (let* ((*read-default-float-format* 'double-float)
         (n (read))
         (d (read))
         (s (read))
         (x (make-array n :element-type 'integer :initial-element 0))
         (res (* n (1+ (* 2 s)))))
    (dotimes (i n) (setf (aref x i) (read)))
    (sort x #'<)
    (dotimes (i n)
      (loop for j from (1+ i) below n do
            (let ((dst (abs (- (aref x i) (aref x j)))))
                (when (zerop (mod dst d))
                      (let ((tmp (1+ (- (* 2 s) (floor dst d)))))
                        (when (plusp tmp)
                              (decf res tmp)
                              (return)))))))
    (format t "~d~%" res)))

(main)
0