結果

問題 No.1373 Directed Operations
コンテスト
ユーザー linuxmetel
提出日時 2021-02-05 22:08:08
言語 Common Lisp
(sbcl 2.6.3)
コンパイル:
sbclc _filename_
実行:
sbcl --script Main.fasl
結果
AC  
実行時間 135 ms / 2,000 ms
コード長 730 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 173 ms
コンパイル使用メモリ 28,672 KB
実行使用メモリ 26,240 KB
最終ジャッジ日時 2026-03-23 20:29:26
合計ジャッジ時間 2,333 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 19
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 23 MAR 2026 08:29:18 PM):

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

ソースコード

diff #
raw source code

(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)
0