結果
問題 |
No.197 手品
|
ユーザー |
|
提出日時 | 2023-07-30 22:08:52 |
言語 | F# (F# 4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,165 bytes |
コンパイル時間 | 9,341 ms |
コンパイル使用メモリ | 188,680 KB |
実行使用メモリ | 32,144 KB |
最終ジャッジ日時 | 2024-10-09 17:06:31 |
合計ジャッジ時間 | 14,124 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 40 WA * 3 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (264 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/
ソースコード
let sBefore = stdin.ReadLine () let n = stdin.ReadLine () |> int let sAfter = stdin.ReadLine () let stateArray = [| "xxx" "xxo" "xox" "xoo" "oxx" "oxo" "oox" "ooo" |] let rec next (arr: bool array) count = if count = 0 then arr else let a = Array.replicate 8 false for i in 0..arr.Length-1 do if arr.[i] then let index1, index2 = match i with | 0 -> 0, 0 | 1 -> 1, 2 | 2 -> 4, 1 | 3 -> 5, 3 | 4 -> 2, 4 | 5 -> 3, 6 | 6 -> 6, 5 | _ -> 7, 7 a.[index1] <- true a.[index2] <- true next a (count-1) let firstState = Array.replicate 8 false firstState.[Array.findIndex ((=)sBefore) stateArray] <- true if n >= 2 then printfn "FAILURE" else next firstState n |> Array.get <| (Array.findIndex ((=)sAfter) stateArray) |> (fun x -> printfn "%s" (if x then "FAILURE" else "SUCCESS"))