結果
問題 | No.38 赤青白ブロック |
ユーザー |
![]() |
提出日時 | 2024-10-25 11:52:03 |
言語 | Common Lisp (sbcl 2.5.0) |
結果 |
AC
|
実行時間 | 2,266 ms / 5,000 ms |
コード長 | 1,088 bytes |
コンパイル時間 | 268 ms |
コンパイル使用メモリ | 33,884 KB |
実行使用メモリ | 86,500 KB |
最終ジャッジ日時 | 2024-10-25 11:53:08 |
合計ジャッジ時間 | 63,414 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 25 OCT 2024 11:52:03 AM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.010
ソースコード
(defun main (&rest argv) (declare (ignorable argv)) (let* ((kr (read)) (kb (read)) (s1 (read-line)) (cs (make-array 31 :element-type 'integer)) (tmp 0) (ma 0)) (dotimes (i 30) (if (char= #\W (aref s1 i)) (setf (aref cs i) 21) (setf (aref cs i) tmp tmp (1+ tmp)))) (dotimes (i 1048576) (let ((s2 "") (ok 1)) (dotimes (j 30) (when (zerop (logand i (ash 1 (aref cs j)))) (setf s2 (concatenate 'string s2 (string (aref s1 j)))) (when (and (char= #\R (aref s1 j)) (> (length s2) kr) (char= #\R (aref s2 (- (length s2) kr 1)))) (setq ok 0)) (when (and (char= #\B (aref s1 j)) (> (length s2) kb) (char= #\B (aref s2 (- (length s2) kb 1)))) (setq ok 0)))) (unless (zerop ok) (setq ma (max ma (length s2)))))) (format t "~d~%" ma))) (main)