結果

問題 No.1373 Directed Operations
ユーザー yuruhiyayuruhiya
提出日時 2021-02-05 21:36:49
言語 Crystal
(1.11.2)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 366 bytes
コンパイル時間 23,247 ms
コンパイル使用メモリ 257,644 KB
実行使用メモリ 15,560 KB
最終ジャッジ日時 2023-09-15 07:22:01
合計ジャッジ時間 22,033 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 3 ms
4,380 KB
testcase_02 AC 20 ms
11,916 KB
testcase_03 AC 15 ms
11,436 KB
testcase_04 AC 19 ms
14,972 KB
testcase_05 AC 2 ms
4,408 KB
testcase_06 AC 35 ms
13,888 KB
testcase_07 AC 3 ms
4,656 KB
testcase_08 AC 6 ms
5,336 KB
testcase_09 AC 35 ms
14,700 KB
testcase_10 AC 29 ms
11,064 KB
testcase_11 AC 9 ms
6,280 KB
testcase_12 AC 29 ms
10,916 KB
testcase_13 AC 6 ms
5,404 KB
testcase_14 AC 39 ms
15,560 KB
testcase_15 AC 33 ms
12,244 KB
testcase_16 AC 39 ms
15,348 KB
testcase_17 AC 19 ms
9,248 KB
testcase_18 AC 9 ms
7,120 KB
testcase_19 AC 16 ms
7,712 KB
testcase_20 AC 21 ms
9,736 KB
権限があれば一括ダウンロードができます

ソースコード

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