結果

問題 No.197 手品
ユーザー natoriusannatoriusan
提出日時 2023-07-30 22:08:52
言語 F#
(F# 4.0)
結果
WA  
実行時間 -
コード長 1,165 bytes
コンパイル時間 9,363 ms
コンパイル使用メモリ 191,248 KB
実行使用メモリ 30,720 KB
最終ジャッジ日時 2024-04-17 23:22:02
合計ジャッジ時間 14,178 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
30,464 KB
testcase_01 AC 68 ms
30,060 KB
testcase_02 AC 67 ms
30,072 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 66 ms
30,456 KB
testcase_06 AC 73 ms
30,464 KB
testcase_07 AC 72 ms
30,336 KB
testcase_08 AC 66 ms
30,444 KB
testcase_09 AC 72 ms
30,592 KB
testcase_10 AC 67 ms
30,200 KB
testcase_11 AC 66 ms
30,208 KB
testcase_12 AC 67 ms
30,080 KB
testcase_13 AC 67 ms
29,952 KB
testcase_14 AC 66 ms
30,080 KB
testcase_15 AC 65 ms
30,336 KB
testcase_16 AC 66 ms
30,076 KB
testcase_17 AC 67 ms
30,072 KB
testcase_18 AC 66 ms
30,080 KB
testcase_19 AC 66 ms
30,464 KB
testcase_20 AC 66 ms
30,464 KB
testcase_21 AC 67 ms
29,816 KB
testcase_22 AC 67 ms
30,336 KB
testcase_23 AC 72 ms
30,592 KB
testcase_24 AC 75 ms
30,464 KB
testcase_25 AC 74 ms
30,464 KB
testcase_26 AC 75 ms
30,328 KB
testcase_27 AC 72 ms
30,720 KB
testcase_28 AC 72 ms
30,592 KB
testcase_29 AC 74 ms
30,208 KB
testcase_30 AC 72 ms
30,328 KB
testcase_31 AC 71 ms
30,592 KB
testcase_32 AC 75 ms
30,464 KB
testcase_33 AC 74 ms
30,336 KB
testcase_34 AC 72 ms
30,464 KB
testcase_35 AC 67 ms
30,208 KB
testcase_36 AC 69 ms
30,072 KB
testcase_37 AC 68 ms
30,464 KB
testcase_38 AC 73 ms
30,464 KB
testcase_39 AC 72 ms
30,592 KB
testcase_40 AC 72 ms
30,464 KB
testcase_41 AC 67 ms
30,336 KB
testcase_42 AC 72 ms
30,460 KB
testcase_43 WA -
testcase_44 AC 70 ms
30,204 KB
testcase_45 AC 69 ms
29,952 KB
testcase_46 AC 68 ms
30,208 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (258 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 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"))
0