結果
| 問題 |
No.185 和風
|
| コンテスト | |
| ユーザー |
Common Lisp
|
| 提出日時 | 2024-10-08 13:42:30 |
| 言語 | Common Lisp (sbcl 2.5.0) |
| 結果 |
AC
|
| 実行時間 | 10 ms / 1,000 ms |
| コード長 | 700 bytes |
| コンパイル時間 | 615 ms |
| コンパイル使用メモリ | 39,276 KB |
| 実行使用メモリ | 21,760 KB |
| 最終ジャッジ日時 | 2024-10-08 13:42:31 |
| 合計ジャッジ時間 | 1,293 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 08 OCT 2024 01:42:29 PM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.008
ソースコード
; 全ての 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)
Common Lisp