結果
問題 |
No.437 cwwゲーム
|
ユーザー |
![]() |
提出日時 | 2017-08-14 22:44:59 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 26 ms / 2,000 ms |
コード長 | 442 bytes |
コンパイル時間 | 5,010 ms |
コンパイル使用メモリ | 178,584 KB |
実行使用メモリ | 8,064 KB |
最終ジャッジ日時 | 2024-10-12 08:44:27 |
合計ジャッジ時間 | 6,611 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 41 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
import Control.Monad main = getLine >>= print . maximum1 . cww cww :: String -> [Int] cww n = do let l = length n i <- [0 .. l-1] j <- [i+1 .. l-1] k <- [j+1 .. l-1] let (c,w1,w2) = (n!!i, n!!j, n!!k) guard ((c /= '0') && (c /= w1) && (w1 == w2)) let next = map snd $ filter (flip notElem [i,j,k] . fst) $ zip [0..] n let x = read [c,w1,w2] return (x + maximum1 (cww next)) maximum1 xs = if null xs then 0 else maximum xs