結果

問題 No.216 FAC
ユーザー まんしmaNNshi
提出日時 2025-04-11 21:57:34
言語 Common Lisp
(sbcl 2.5.0)
結果
RE  
実行時間 -
コード長 712 bytes
コンパイル時間 595 ms
コンパイル使用メモリ 33,092 KB
実行使用メモリ 32,212 KB
最終ジャッジ日時 2025-04-11 21:57:36
合計ジャッジ時間 2,201 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12 WA * 1 RE * 11
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 11 APR 2025 09:57:34 PM):

; wrote /home/judge/data/code/Main.fasl
; compilation finished in 0:00:00.069

ソースコード

diff #

(defvar N)
(defvar a)
(defvar b)
(setq N (parse-integer (read-line)))
(setq a (read-from-string (concatenate 'string "(" (read-line) ")")))
(setq b (read-from-string (concatenate 'string "(" (read-line) ")")))

;(print N)
;(print a)
;(print b)

(defvar sum)
(defvar nokori)
(defvar sum (make-array 100 :initial-element 0))
(defvar nokori 0)
(loop for i from 0 to (- N 1) do
	(if (= (nth i b) 0) (setq nokori (+ nokori (nth i a)))
	 	(setf (aref sum (nth i b)) (+ (aref sum (nth i b)) (nth i a))))
	(values)
)
;(print sum)
;(print nokori)

;(format t "~a~%" (if (>= nokori (max sum)) "YES" "NO"))
(loop for i from 0 to (- N 1) do
	(if (< nokori (aref sum i)) (progn (format t "NO~%") (quit))))
(format t "YES~%")
0