結果
問題 | No.150 "良問"(良問とは言っていない |
ユーザー |
![]() |
提出日時 | 2024-11-10 16:28:37 |
言語 | Common Lisp (sbcl 2.5.0) |
結果 |
AC
|
実行時間 | 10 ms / 5,000 ms |
コード長 | 1,081 bytes |
コンパイル時間 | 501 ms |
コンパイル使用メモリ | 30,720 KB |
実行使用メモリ | 22,016 KB |
最終ジャッジ日時 | 2024-11-10 16:28:40 |
合計ジャッジ時間 | 2,188 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 20 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 10 NOV 2024 04:28:37 PM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.037
ソースコード
(defconstant +good+ "good")(defconstant +problem+ "problem")(defun main (&rest argv)(declare (ignorable argv))(let* ((query (read)))(dotimes (_ query)(let* ((s (read-line))(n (length s))(good-count (make-array 101 :element-type 'integer :initial-element 0))(problem-count (make-array 101 :element-type 'integer :initial-element 0))(res 0))(dotimes (i (- n 10))(dotimes (j 4)(when (char= (char s (+ i j)) (char +good+ j))(incf (aref good-count i)))))(loop for i from 4 below (- n 6) do(dotimes (j 7)(when (char= (char s (+ i j)) (char +problem+ j))(incf (aref problem-count i)))))(loop for i below (- n 10) do(loop for j from (+ i 4) below (- n 6)when (< res (+ (aref good-count i) (aref problem-count j)))do (setq res (+ (aref good-count i) (aref problem-count j)))))(format t "~d~%" (- 11 res))))))(main)