結果

問題 No.930 数列圧縮
ユーザー yuruhiyayuruhiya
提出日時 2020-10-25 17:28:17
言語 Crystal
(1.10.0)
結果
AC  
実行時間 23 ms / 2,000 ms
コード長 423 bytes
コンパイル時間 18,632 ms
コンパイル使用メモリ 254,436 KB
実行使用メモリ 14,548 KB
最終ジャッジ日時 2023-09-13 12:32:07
合計ジャッジ時間 21,468 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,376 KB
testcase_01 AC 3 ms
4,444 KB
testcase_02 AC 3 ms
4,376 KB
testcase_03 AC 3 ms
4,508 KB
testcase_04 AC 3 ms
4,508 KB
testcase_05 AC 3 ms
4,588 KB
testcase_06 AC 2 ms
4,508 KB
testcase_07 AC 3 ms
4,664 KB
testcase_08 AC 14 ms
9,752 KB
testcase_09 AC 16 ms
10,284 KB
testcase_10 AC 14 ms
9,444 KB
testcase_11 AC 15 ms
9,760 KB
testcase_12 AC 17 ms
12,092 KB
testcase_13 AC 8 ms
8,012 KB
testcase_14 AC 10 ms
8,832 KB
testcase_15 AC 20 ms
12,812 KB
testcase_16 AC 20 ms
12,824 KB
testcase_17 AC 22 ms
12,712 KB
testcase_18 AC 20 ms
12,860 KB
testcase_19 AC 23 ms
12,664 KB
testcase_20 AC 22 ms
12,816 KB
testcase_21 AC 21 ms
12,764 KB
testcase_22 AC 3 ms
4,380 KB
testcase_23 AC 21 ms
14,548 KB
testcase_24 AC 2 ms
4,492 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,376 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)
if a[0] < a[-1]
  puts "Yes"
  ans = [] of Int32
  (1..n - 2).each do |i|
    ans << a[i] if a[0] < a[i]
  end
  (1..n - 2).reverse_each do |i|
    ans << a[i] if a[i] < a[0]
  end
  ans << a[0]
  puts ans.join(' ')
else
  puts "No"
end
0