結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
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 113 ms
31,220 KB
testcase_10 WA -
testcase_11 AC 114 ms
31,600 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 110 ms
31,480 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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


ans = []
n.times { |i|
  j = a[i,n].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