結果
| 問題 |
No.1373 Directed Operations
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-02-05 22:08:08 |
| 言語 | Common Lisp (sbcl 2.5.0) |
| 結果 |
AC
|
| 実行時間 | 262 ms / 2,000 ms |
| コード長 | 730 bytes |
| コンパイル時間 | 475 ms |
| コンパイル使用メモリ | 33,520 KB |
| 実行使用メモリ | 27,648 KB |
| 最終ジャッジ日時 | 2024-07-02 12:36:21 |
| 合計ジャッジ時間 | 4,006 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 19 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 02 JUL 2024 12:36:16 PM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.213
ソースコード
(defvar n (read))
(defparameter a (sort (apply #'vector (cons -100000000 1) (loop for i from 1 to (1- n)
collect (cons (read) i)))
#'(lambda (x y) (< (car x) (car y)))))
(defvar f nil)
(defparameter ans (make-array n))
(loop for i from 1 to (1- n)
until f
do (if (<= (car (aref a i)) i)
(setf (aref ans (cdr (aref a i))) (1+ (- i (car (aref a i)))))
(setq f t)))
(if f
(progn (princ "NO")
(fresh-line))
(progn (princ "YES")
(fresh-line)
(loop for i from 1 to (1- n)
do (princ (aref ans i))
(fresh-line))))
;(princ a)