結果

問題 No.1373 Directed Operations
ユーザー yuruhiyayuruhiya
提出日時 2021-02-05 21:38:11
言語 Crystal
(1.11.2)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 231 bytes
コンパイル時間 19,009 ms
コンパイル使用メモリ 256,768 KB
実行使用メモリ 15,432 KB
最終ジャッジ日時 2023-09-15 07:26:02
合計ジャッジ時間 21,108 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,404 KB
testcase_01 AC 2 ms
4,508 KB
testcase_02 AC 18 ms
12,004 KB
testcase_03 AC 15 ms
11,420 KB
testcase_04 AC 18 ms
13,616 KB
testcase_05 AC 3 ms
4,432 KB
testcase_06 AC 36 ms
13,872 KB
testcase_07 AC 3 ms
4,732 KB
testcase_08 AC 6 ms
5,476 KB
testcase_09 AC 34 ms
13,712 KB
testcase_10 AC 28 ms
11,212 KB
testcase_11 AC 9 ms
6,376 KB
testcase_12 AC 28 ms
10,976 KB
testcase_13 AC 5 ms
5,384 KB
testcase_14 AC 38 ms
15,368 KB
testcase_15 AC 34 ms
12,224 KB
testcase_16 AC 38 ms
15,432 KB
testcase_17 AC 18 ms
9,224 KB
testcase_18 AC 9 ms
7,112 KB
testcase_19 AC 16 ms
7,800 KB
testcase_20 AC 21 ms
9,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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