結果
問題 |
No.672 最長AB列
|
ユーザー |
![]() |
提出日時 | 2018-06-08 08:18:49 |
言語 | F# (F# 4.0) |
結果 |
AC
|
実行時間 | 816 ms / 2,000 ms |
コード長 | 413 bytes |
コンパイル時間 | 6,819 ms |
コンパイル使用メモリ | 201,416 KB |
実行使用メモリ | 79,524 KB |
最終ジャッジ日時 | 2024-06-30 10:37:25 |
合計ジャッジ時間 | 17,191 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (233 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/
ソースコード
stdin.ReadLine().ToCharArray() |> Array.indexed |> Array.fold(fun (mem,counter,maxLen) (idx,c) -> let counter = match c with |'A' -> counter + 1 | _ -> counter - 1 match Map.containsKey counter mem with | true -> (mem, counter, (max maxLen (idx - mem.[counter]))) | _ -> ((mem.Add(counter,idx)), counter, maxLen)) (Map.ofList[0,-1],0,0) |> fun (_,_,maxLen) -> printfn "%i" maxLen