結果
| 問題 |
No.1268 Fruit Rush 2
|
| コンテスト | |
| ユーザー |
Common Lisp
|
| 提出日時 | 2024-11-11 20:40:41 |
| 言語 | Common Lisp (sbcl 2.5.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 716 bytes |
| コンパイル時間 | 521 ms |
| コンパイル使用メモリ | 47,832 KB |
| 実行使用メモリ | 34,652 KB |
| 最終ジャッジ日時 | 2024-11-11 20:40:49 |
| 合計ジャッジ時間 | 7,653 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | AC * 6 WA * 27 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 11 NOV 2024 08:40:42 PM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.059
ソースコード
(defun main (&rest argv)
(declare (ignorable argv))
(let* ((n (read))
(a (make-array n :element-type 'integer))
(dp (make-array (1+ n) :element-type 'integer :initial-element 0))
(res n))
(dotimes (i n) (setf (aref a i) (read)))
(sort a #'<)
(loop for i from n downto 0 do
(when (and (< (+ i 1) n) (= (+ (aref a i) 2) (aref a (+ i 1)))) (setf (aref dp i) (1+ (aref dp (+ i 1)))))
(when (and (< (+ i 2) n) (= (+ (aref a i) 2) (aref a (+ i 2)))) (setf (aref dp i) (1+ (aref dp (+ i 2))))))
(loop for i below (1- n)
when (/= (1+ (aref a i)) (aref a (1+ i)))
do (incf res (1+ (aref dp (1+ i)))))
(format t "~d~%" res)))
(main)
Common Lisp