結果

問題 No.533 Mysterious Stairs
コンテスト
ユーザー Common Lisp
提出日時 2024-11-08 13:30:14
言語 Common Lisp
(sbcl 2.6.7)
コンパイル:
sbclc _filename_
実行:
sbcl --script Main.fasl
結果
AC  
実行時間 67 ms / 5,000 ms
+ 731µs
コード長 666 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,131 ms
コンパイル使用メモリ 36,652 KB
実行使用メモリ 57,024 KB
最終ジャッジ日時 2026-09-21 07:06:33
合計ジャッジ時間 3,075 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 21 SEP 2026 07:06:29 AM):

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

ソースコード

diff #
raw source code

(defconstant +mod+ 1000000007)

(defun main (&rest argv)
  (declare (ignorable argv))
  (let* ((n (read))
         (dp (make-array (list (1+ n) 4) :initial-element 0)))
    (setf (aref dp 0 0) 1)
    (loop for i from 1 to n do
          (loop for j from 1 below 4
                when (>= i j)
                  do (dotimes (k 4)
                       (when (/= j k)
                             (incf (aref dp i j)
                                   (aref dp (- i j) k))))
                     (setf (aref dp i j) (mod (aref dp i j) +mod+))))
    (format t "~d~%" (mod (loop for i from 0 below 4
                                sum (aref dp n i)) +mod+))))

(main)
0