結果

問題 No.365 ジェンガソート
ユーザー mizocoder
提出日時 2018-08-09 00:04:15
言語 Ruby
(3.4.1)
結果
AC  
実行時間 592 ms / 2,000 ms
コード長 261 bytes
コンパイル時間 182 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 25,344 KB
最終ジャッジ日時 2024-09-23 04:15:36
合計ジャッジ時間 13,237 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 41
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

# 再々修正。三度目の正直!
n = gets.to_i
num = gets.split.map(&:to_i)
numary = []

num.each_with_index {|num, idx| numary << [num, idx] }
numary.sort!.reverse!

i = 0
while i < n-1
	break if numary[i][1] < numary[i+1][1]
	i += 1
end

puts n - (i+1)
0