結果
| 問題 |
No.406 鴨等間隔の法則
|
| コンテスト | |
| ユーザー |
Common Lisp
|
| 提出日時 | 2024-10-09 18:34:20 |
| 言語 | Common Lisp (sbcl 2.5.0) |
| 結果 |
AC
|
| 実行時間 | 112 ms / 2,000 ms |
| コード長 | 451 bytes |
| コンパイル時間 | 50 ms |
| コンパイル使用メモリ | 33,344 KB |
| 実行使用メモリ | 32,844 KB |
| 最終ジャッジ日時 | 2024-10-09 18:34:24 |
| 合計ジャッジ時間 | 3,880 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 09 OCT 2024 06:34:20 PM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.006
ソースコード
; ソートして 3 項ずつ等差数列になっているかチェックし
; 全て等差数列になっていれば YES それ以外は NO を出力
(defun main ()
(let* ((n (read))
(xs (sort (loop repeat n collect (read)) #'<)))
(princ (if (loop for (x1 x2 x3) on xs
while x3
always (and (= (- x2 x1) (- x3 x2)) (/= x2 x1)))
"YES"
"NO"))
(terpri)))
(main)
Common Lisp