結果

問題 No.197 手品
コンテスト
ユーザー natoriusan
提出日時 2023-07-30 21:47:35
言語 F#
(F# 10.0)
コンパイル:
fsharp_c _filename_
実行:
/usr/bin/dotnet_wrap
結果
TLE  
実行時間 -
コード長 545 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 5,851 ms
コンパイル使用メモリ 212,240 KB
実行使用メモリ 68,224 KB
最終ジャッジ日時 2026-04-25 20:33:37
合計ジャッジ時間 9,011 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 4
other AC * 3 TLE * 1 -- * 39
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (348 ミリ秒)。
  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

let sBefore = stdin.ReadLine ()
let n = stdin.ReadLine () |> int
let sAfter = stdin.ReadLine ()
    
let rec next (stateSet: string Set) count =
    if count = 0 then
        stateSet
    else
        let mutable s = Set.empty
        for i in stateSet do
            s <- s.Add <| string i.[1] + string i.[0] + string i.[2]
            s <- s.Add <| string i.[0] + string i.[2] + string i.[1]
        next s (count-1)
        
next (Set.empty.Add sBefore) n |> Set.contains sAfter |> (fun x -> printfn "%s" (if x then "FAILURE" else "SUCCESS"))
0