結果

問題 No.26 シャッフルゲーム
ユーザー hum_ophum_op
提出日時 2016-04-16 14:54:15
言語 F#
(F# 4.0)
結果
AC  
実行時間 312 ms / 5,000 ms
コード長 492 bytes
コンパイル時間 6,128 ms
コンパイル使用メモリ 186,016 KB
実行使用メモリ 35,692 KB
最終ジャッジ日時 2024-04-15 02:10:54
合計ジャッジ時間 10,335 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 310 ms
35,308 KB
testcase_01 AC 308 ms
34,644 KB
testcase_02 AC 307 ms
35,560 KB
testcase_03 AC 309 ms
35,668 KB
testcase_04 AC 312 ms
35,408 KB
testcase_05 AC 309 ms
35,496 KB
testcase_06 AC 309 ms
35,624 KB
testcase_07 AC 311 ms
35,692 KB
testcase_08 AC 308 ms
35,304 KB
testcase_09 AC 310 ms
35,556 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (207 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

open System

let No26 () =
    let N = int <| Console.ReadLine()
    let M = int <| Console.ReadLine()
    let rec res i n =
        if i < M then
            let IN = Console.ReadLine().Split(' ')
            let P, Q = Int32.Parse IN.[0], Int32.Parse IN.[1]
            if n = P then
                res (i + 1) Q
            elif n = Q then
                res (i + 1) P
            else 
                res (i + 1) n
        else
            n
    printfn "%d" <| res 0 N
    ()

No26 ()
0