結果

問題 No.397 NO MORE KADOMATSU
ユーザー TANIGUCHI KousukeTANIGUCHI Kousuke
提出日時 2020-02-20 16:37:13
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 285 bytes
コンパイル時間 370 ms
コンパイル使用メモリ 11,608 KB
実行使用メモリ 31,020 KB
平均クエリ数 0.11
最終ジャッジ日時 2023-09-23 19:43:10
合計ジャッジ時間 4,601 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

N = gets.to_i
A = gets.split.map(&:to_i)
O = (0 ... N).sort_by{|i| A[i] }
used = Array.new(N)
T = N.times.map do |i| 
  if O[i] != i && A[O[i]] != A[i] && !used[i] 
    used[i] = used[O[i]] = true
    "#{i} #{O[i]}"
  else
    nil
  end
end
T.compact!
puts T
$stdout.flush
gets
exit(0)
0