結果
問題 | No.326 あみだますたー |
ユーザー |
|
提出日時 | 2015-12-19 05:15:41 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 100 ms / 2,000 ms |
コード長 | 302 bytes |
コンパイル時間 | 48 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 13,184 KB |
最終ジャッジ日時 | 2024-12-26 05:56:39 |
合計ジャッジ時間 | 4,194 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 26 |
コンパイルメッセージ
Syntax OK
ソースコード
#!/usr/bin/rubyN=gets.to_iA=[*1..N]gets.to_i.times{a=gets.to_iA[a-1],A[a]=A[a],A[a-1]}B=[nil]*Ngets.split.each_with_index{|e,i|B[e.to_i-1]=i+1}R=[](N-1).downto(1){|i|t=B[i]1.upto(i){|j|if A[j-1]==tR<<[j,j+1]A[j-1],A[j]=A[j],A[j-1]end}}p R.sizeputs R.map{|e|'%d %d'%e}