結果
| 問題 |
No.1537 私の代わりに仕事やっといてください。
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-11-15 09:30:44 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 434 ms / 2,000 ms |
| コード長 | 278 bytes |
| コンパイル時間 | 61 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 51,156 KB |
| 最終ジャッジ日時 | 2024-12-14 06:18:28 |
| 合計ジャッジ時間 | 2,433 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 9 |
コンパイルメッセージ
Syntax OK
ソースコード
N = gets.to_i
A = gets.split(" ").map.with_index{|s, i| [s.to_i, i+1]}
top = true
ans = []
A.sort_by{|x, i| -x}.each {|x, i|
if top then
ans.unshift(i.to_s)
else
ans.push(i.to_s)
end
top = !top
}
i = ans.index("1")
puts (ans[i, N-i] + ans[0, i] + ["1"]).join(" ")