結果

問題 No.216 FAC
ユーザー Michae'Gon
提出日時 2015-07-17 16:10:22
言語 Haskell
(9.10.1)
結果
WA  
実行時間 -
コード長 479 bytes
コンパイル時間 1,215 ms
コンパイル使用メモリ 174,336 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-08 08:25:01
合計ジャッジ時間 1,960 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22 WA * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
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

ソースコード

diff #

import Data.List
main = getLine >> getLine >>= main' . map read . words
        where
                main' xs = getLine >>= putStrLn . solve . zip xs . map read . words

solve :: [(Int, Int)] -> String
solve xs
        | acc < mnum = "NO"
        | otherwise = "YES"
        where
                (acc, mnum) = foldl ff (0, 0) xs

ff :: (Int, Int) -> (Int, Int) -> (Int, Int)
ff (acc, mnum) (x, y)
        | y == 0 = (acc + x, max mnum x)
        | otherwise = (acc, max mnum x)
0