結果

問題 No.26 シャッフルゲーム
コンテスト
ユーザー hum_op
提出日時 2016-04-16 14:54:15
言語 F#
(F# 10.0)
コンパイル:
fsharp_c _filename_
実行:
/usr/bin/dotnet_wrap
結果
AC  
実行時間 212 ms / 5,000 ms
コード長 492 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 5,957 ms
コンパイル使用メモリ 213,976 KB
実行使用メモリ 38,108 KB
最終ジャッジ日時 2026-04-20 06:48:32
合計ジャッジ時間 9,198 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (179 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net10.0/main.dll
  main -> /home/judge/data/code/bin/Release/net10.0/publish/

ソースコード

diff #
raw source code

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