結果

問題 No.26 シャッフルゲーム
ユーザー regeregeregerege
提出日時 2016-01-11 19:15:50
言語 F#
(F# 4.0)
結果
AC  
実行時間 116 ms / 5,000 ms
コード長 609 bytes
コンパイル時間 7,107 ms
コンパイル使用メモリ 190,076 KB
実行使用メモリ 33,792 KB
最終ジャッジ日時 2023-10-19 22:48:39
合計ジャッジ時間 9,065 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
33,756 KB
testcase_01 AC 116 ms
33,756 KB
testcase_02 AC 115 ms
33,792 KB
testcase_03 AC 116 ms
33,772 KB
testcase_04 AC 115 ms
33,776 KB
testcase_05 AC 114 ms
33,776 KB
testcase_06 AC 114 ms
33,776 KB
testcase_07 AC 113 ms
33,776 KB
testcase_08 AC 115 ms
33,784 KB
testcase_09 AC 116 ms
33,792 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (248 ms)。
MSBuild のバージョン 17.7.3+8ec440e68 (.NET)
  main -> /home/judge/data/code/bin/Release/net7.0/main.dll
  main -> /home/judge/data/code/bin/Release/net7.0/publish/

ソースコード

diff #

let ``No.26 シャッフルゲーム`` () =
    let N = int <| stdin.ReadLine()
    let M = int <| stdin.ReadLine()
    let rec f s bit =
        if s <= 0 then bit - (bit>>>2)
        else
            let arr =
                stdin.ReadLine().Split(' ')
                |> Array.map int
                |> Array.sort
            let a,b2 = arr.[0],arr.[1]
            let n = b2 - a
            let b = 1 <<< (b2 - 1)
            let c = bit ^^^ (bit &&& (a ||| b))
            f (s-1) ((((bit&&&b)>>>n)|||((bit&&&a)<<<n))|||c)
    f M (1 <<< N - 1)
    |> printfn "%A"
``No.26 シャッフルゲーム`` ()
0