結果

問題 No.241 出席番号(1)
ユーザー kazasikikazasiki
提出日時 2015-07-10 23:39:50
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 399 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 11,268 KB
実行使用メモリ 15,320 KB
最終ジャッジ日時 2023-09-22 10:23:19
合計ジャッジ時間 5,704 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
15,320 KB
testcase_01 AC 77 ms
15,096 KB
testcase_02 AC 77 ms
15,280 KB
testcase_03 AC 78 ms
15,124 KB
testcase_04 AC 78 ms
15,260 KB
testcase_05 WA -
testcase_06 AC 78 ms
15,280 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 77 ms
15,192 KB
testcase_10 AC 78 ms
15,220 KB
testcase_11 AC 77 ms
15,140 KB
testcase_12 AC 77 ms
15,280 KB
testcase_13 AC 79 ms
15,244 KB
testcase_14 AC 78 ms
15,316 KB
testcase_15 AC 77 ms
15,144 KB
testcase_16 AC 78 ms
15,012 KB
testcase_17 WA -
testcase_18 AC 78 ms
15,192 KB
testcase_19 AC 77 ms
15,240 KB
testcase_20 AC 78 ms
15,072 KB
testcase_21 AC 77 ms
15,116 KB
testcase_22 AC 76 ms
15,164 KB
testcase_23 AC 77 ms
15,244 KB
testcase_24 AC 77 ms
15,016 KB
testcase_25 AC 77 ms
15,020 KB
testcase_26 AC 79 ms
15,276 KB
testcase_27 AC 79 ms
15,220 KB
testcase_28 AC 78 ms
15,272 KB
testcase_29 AC 78 ms
15,196 KB
testcase_30 AC 77 ms
15,100 KB
testcase_31 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:9: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

# input
N = gets.to_i
A = N.times.map{
      gets.to_i
    }

# solve
if A.uniq.size == 1
  print -1
else
  kouho = (0..N-1).to_a
  if A.last == kouho.last
    tmp = kouho.first
    kouho[0] = kouho.last
    kouho[N-1] = tmp
  end
  result =
    A.map{|num|
      tmp = kouho.first == num ? kouho[1] : kouho[0]
      kouho.delete(tmp)
      tmp
    }
  result.each{|num|
    print "#{num}\n"
  }
end
0