結果

問題 No.123 カードシャッフル
ユーザー バカらっくバカらっく
提出日時 2018-03-03 01:11:45
言語 Swift
(5.10.0)
結果
AC  
実行時間 79 ms / 5,000 ms
コード長 365 bytes
コンパイル時間 1,221 ms
コンパイル使用メモリ 130,816 KB
実行使用メモリ 14,060 KB
最終ジャッジ日時 2023-08-20 10:27:54
合計ジャッジ時間 2,395 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
8,152 KB
testcase_01 AC 4 ms
8,224 KB
testcase_02 AC 3 ms
8,124 KB
testcase_03 AC 3 ms
8,140 KB
testcase_04 AC 4 ms
8,076 KB
testcase_05 AC 4 ms
8,172 KB
testcase_06 AC 3 ms
8,172 KB
testcase_07 AC 4 ms
8,220 KB
testcase_08 AC 3 ms
8,136 KB
testcase_09 AC 3 ms
8,156 KB
testcase_10 AC 61 ms
13,580 KB
testcase_11 AC 79 ms
13,528 KB
testcase_12 AC 78 ms
12,852 KB
testcase_13 AC 79 ms
14,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

let inpt = readLine()!.split(separator: " ").map{Int($0)!}
let itemCount = inpt[0]
let shuffCount = inpt[1]

var cards = [Int]()
for i in 1...itemCount {
    cards.append(i)
}

let shuffle = readLine()!.split(separator: " ").map{Int($0)! - 1}

for sh in shuffle {
    let tmp = cards[sh]
    cards.remove(at: sh)
    cards.insert(tmp, at: 0)
}

print(cards.first!)
0