結果

問題 No.197 手品
ユーザー natoriusan
提出日時 2023-07-30 21:47:35
言語 F#
(F# 4.0)
結果
TLE  
実行時間 -
コード長 545 bytes
コンパイル時間 15,155 ms
コンパイル使用メモリ 195,192 KB
実行使用メモリ 61,476 KB
最終ジャッジ日時 2024-10-09 16:44:55
合計ジャッジ時間 12,149 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 4
other AC * 3 TLE * 1 -- * 39
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (418 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 #

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