結果

問題 No.26 シャッフルゲーム
ユーザー MaboyMaboy
提出日時 2021-05-30 15:44:37
言語 Swift
(5.10.0)
結果
AC  
実行時間 4 ms / 5,000 ms
コード長 287 bytes
コンパイル時間 4,115 ms
コンパイル使用メモリ 133,104 KB
実行使用メモリ 8,196 KB
最終ジャッジ日時 2023-08-08 15:09:31
合計ジャッジ時間 5,360 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
8,104 KB
testcase_01 AC 3 ms
8,196 KB
testcase_02 AC 4 ms
8,136 KB
testcase_03 AC 3 ms
8,148 KB
testcase_04 AC 3 ms
8,164 KB
testcase_05 AC 3 ms
8,144 KB
testcase_06 AC 3 ms
8,124 KB
testcase_07 AC 3 ms
8,068 KB
testcase_08 AC 3 ms
8,132 KB
testcase_09 AC 3 ms
8,164 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

var cup = [0,0,0]
let N:Int = Int(readLine()!)!
cup[N - 1] = 1
let M:Int = Int(readLine()!)!
for _ in 1...M{
    let PQ = readLine()!.split(separator:" ").map{Int($0)!}
    let P = PQ[0] - 1
    let Q = PQ[1] - 1
    cup.swapAt(P, Q)
}
let index = cup.firstIndex(of: 1)!
print(index + 1)
0