結果

問題 No.1373 Directed Operations
ユーザー yuruhiya
提出日時 2021-02-05 21:36:49
言語 Crystal
(1.14.0)
結果
AC  
実行時間 34 ms / 2,000 ms
コード長 366 bytes
コンパイル時間 11,464 ms
コンパイル使用メモリ 295,984 KB
実行使用メモリ 13,144 KB
最終ジャッジ日時 2024-07-02 11:48:32
合計ジャッジ時間 13,458 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

lib C
  fun strtoll(s : UInt8*, p : UInt8**, b : Int32) : Int64
end

class String
  def to_i64
    C.strtoll(self, nil, 10)
  end
end

n = read_line.to_i
a = read_line.split.map(&.to_i).each_with_index.to_a.sort
ans = [0] * ~-n
(0...n - 1).each do |i|
  if i + 1 < a[i][0]
    puts "NO"
    exit
  end
  ans[a[i][1]] = i + 2 - a[i][0]
end
puts "YES", ans.join('\n')
0