結果

問題 No.123 カードシャッフル
ユーザー quilt-tailsquilt-tails
提出日時 2016-11-19 04:27:50
言語 Ruby
(3.3.0)
結果
AC  
実行時間 205 ms / 5,000 ms
コード長 179 bytes
コンパイル時間 320 ms
コンパイル使用メモリ 11,284 KB
実行使用メモリ 21,344 KB
最終ジャッジ日時 2023-08-17 14:03:46
合計ジャッジ時間 2,554 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
15,188 KB
testcase_01 AC 83 ms
15,172 KB
testcase_02 AC 83 ms
15,256 KB
testcase_03 AC 78 ms
15,156 KB
testcase_04 AC 78 ms
15,160 KB
testcase_05 AC 79 ms
15,088 KB
testcase_06 AC 78 ms
15,244 KB
testcase_07 AC 80 ms
15,340 KB
testcase_08 AC 80 ms
15,152 KB
testcase_09 AC 79 ms
15,144 KB
testcase_10 AC 134 ms
21,344 KB
testcase_11 AC 171 ms
21,328 KB
testcase_12 AC 205 ms
21,232 KB
testcase_13 AC 204 ms
21,228 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n, m = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
b = []
for i in 1..n do
  b.push(i)
end
m.times do |i|
  temp = b[a[i]-1]
  b.delete(temp)
  b.unshift(temp)
end
p b.first
0