結果

問題 No.1537 私の代わりに仕事やっといてください。
ユーザー simansiman
提出日時 2023-02-02 20:09:50
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 314 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 11,232 KB
実行使用メモリ 48,832 KB
最終ジャッジ日時 2023-09-15 01:17:49
合計ジャッジ時間 5,149 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
19,668 KB
testcase_01 AC 86 ms
15,000 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
A = gets.split.map(&:to_i)
nums = []

A.each.with_index(1) do |a, i|
  nums << [a, i]
end

nums.sort_by! { |a, _| a }

ans = []

nums.each.with_index do |(a, i), idx|
  if idx.even?
    ans.push(i)
  else
    ans.unshift(i)
  end
end

while ans[0] != 1
  ans.rotate!
end

ans << 1
puts ans.join(' ')
0