結果
| 問題 |
No.547 未知の言語
|
| コンテスト | |
| ユーザー |
Common Lisp
|
| 提出日時 | 2024-10-10 20:31:41 |
| 言語 | Common Lisp (sbcl 2.5.0) |
| 結果 |
AC
|
| 実行時間 | 10 ms / 2,000 ms |
| コード長 | 1,298 bytes |
| コンパイル時間 | 1,498 ms |
| コンパイル使用メモリ | 27,648 KB |
| 実行使用メモリ | 22,400 KB |
| 最終ジャッジ日時 | 2024-10-10 20:31:45 |
| 合計ジャッジ時間 | 2,213 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 33 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 10 OCT 2024 08:31:41 PM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.065
ソースコード
; (read) の読み込みによってシンボルの大文字小文字の区別が失われるので
; デフォルトで :upcase になっている readtable を更新しなければいけない
; (*readtable* (copy-readtable nil))
; で readtable のコピーをとっておき
; (setf (readtable-case *readtable*) :preserve)
; で区別をつけるようにする
; https://cl-community-spec.github.io/pages/Effect-of-Readtable-Case-on-the-Lisp-Reader.html
; https://cl-community-spec.github.io/pages/Examples-of-Effect-of-Readtable-Case-on-the-Lisp-Reader.html
(defun main (&rest argv)
(declare (ignorable argv))
(let* ((n (read))
(*readtable* (copy-readtable nil)))
; https://cl-community-spec.github.io/pages/readtable_002dcase.html
(setf (readtable-case *readtable*) :preserve)
; ここで読み込まれるシンボルは大文字小文字の区別がついている
(let ((sn (loop repeat n collect (read)))
(tn (loop repeat n collect (read))))
(loop for i below n
for a in sn
for b in tn
while (eql a b)
finally (princ (1+ i))
(terpri)
(princ a)
(terpri)
(princ b)
(terpri)))))
(main)
Common Lisp