結果

問題 No.185 和風
コンテスト
ユーザー Common Lisp
提出日時 2024-10-08 13:42:30
言語 Common Lisp
(sbcl 2.6.7)
コンパイル:
sbclc _filename_
実行:
sbcl --script Main.fasl
結果
AC  
実行時間 6 ms / 1,000 ms
+ 463µs
コード長 700 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 13 ms
コンパイル使用メモリ 27,776 KB
実行使用メモリ 19,712 KB
最終ジャッジ日時 2026-09-12 02:39:28
合計ジャッジ時間 1,322 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 12 SEP 2026 02:39:26 AM):

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

ソースコード

diff #
raw source code

; 全ての yi - xi を求める
; その値が正の整数かつ全て同じ値ならばそれを出力
; そうでなければ -1 を出力する
(defun main ()
  (let* ((n (read))
             ; remove-duplicates sequence &key from-end test test-not start end key => result-sequence
             ; sequence の中の重複する要素を除いたシーケンスをコピーして返す
         (xs (remove-duplicates
                 (loop repeat n
                       for x = (read)
                       for y = (read)
                       collect (- y x))))
         (xslen (length xs))
         (ans (car xs)))
    (princ (if (and (= xslen 1) (plusp ans)) ans -1))
    (terpri)))
(main)
0