結果

問題 No.397 NO MORE KADOMATSU
ユーザー tubo28tubo28
提出日時 2016-07-16 17:31:03
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 229 bytes
コンパイル時間 55 ms
コンパイル使用メモリ 11,516 KB
実行使用メモリ 31,568 KB
平均クエリ数 58.11
最終ジャッジ日時 2023-09-23 11:10:43
合計ジャッジ時間 5,068 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
30,680 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 110 ms
31,036 KB
testcase_10 WA -
testcase_11 AC 109 ms
31,240 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 103 ms
31,052 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_i
a = gets.split.map(&:to_i)


ans = []
n.times { |i|
  j = a.each_with_index.min[1]
  if i != j
    a[i], a[j] = a[j], a[i]
    ans << [i,j]
  end
}

puts ans.size
ans.each { |a,b|
  puts "#{a} #{b}"
}
$>.flush

gets
0