結果
問題 | No.179 塗り分け |
ユーザー |
![]() |
提出日時 | 2024-11-09 02:38:24 |
言語 | Common Lisp (sbcl 2.5.0) |
結果 |
AC
|
実行時間 | 349 ms / 3,000 ms |
コード長 | 1,528 bytes |
コンパイル時間 | 1,337 ms |
コンパイル使用メモリ | 31,360 KB |
実行使用メモリ | 87,936 KB |
最終ジャッジ日時 | 2024-11-09 02:38:32 |
合計ジャッジ時間 | 6,382 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 40 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 09 NOV 2024 02:38:24 AM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.047
ソースコード
(defun check (x y h w s) (let ((ss (make-array (list 101 101) :initial-element nil))) (dotimes (yy h) (dotimes (xx w) (unless (or (char= #\. (char (aref s yy) xx)) (aref ss yy xx)) (setf (aref ss yy xx) t) (let ((yyy (+ yy y)) (xxx (+ xx x))) (when (or (< yyy 0) (>= yyy h) (< xxx 0) (>= xxx w)) (return-from check nil)) (if (and (char= #\# (char (aref s yyy) xxx)) (not (aref ss yyy xxx))) (setf (aref ss yyy xxx) t) (return-from check nil)))))) (dotimes (yy h) (dotimes (xx w) (when (and (char= #\# (char (aref s yy) xx)) (not (aref ss yy xx))) (return-from check nil)))) t)) (defun main (&rest argv) (declare (ignorable argv)) (let* ((h (read)) (w (read)) (sharp-count 0) (s (make-array h :element-type 'string))) (dotimes (i h) (setf (aref s i) (read-line)) (dotimes (j w) (when (char= #\# (char (aref s i) j)) (incf sharp-count)))) (when (or (oddp sharp-count) (zerop sharp-count)) (format t "NO~%") (return-from main)) (loop for x from (- w) to w do (loop for y from (- h) to h when (check x y h w s) do (format t "YES~%") (return-from main))) (format t "NO~%"))) (main)