結果

問題 No.216 FAC
ユーザー ducktail
提出日時 2019-07-30 15:30:19
言語 Haskell
(9.10.1)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 490 bytes
コンパイル時間 6,258 ms
コンパイル使用メモリ 203,776 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-04 18:51:41
合計ジャッジ時間 7,008 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 Control.Applicative
import Data.Bool (bool)
import Data.Vector.Unboxed (Vector, (!), (//))
import qualified Data.Vector.Unboxed as V

main :: IO ()
main = getLine >> solve <$> f <*> f >>= putStrLn
  where
    f = map read <$> words <$> getLine

solve :: [Int] -> [Int] -> String
solve as bs = bool "YES" "NO" $ any g [1 .. 100]
  where
    vi = V.replicate 101 0 :: Vector Int
    f v (p, i) = v // [(i, v ! i + p)]
    v = foldl f vi (zip as bs)
    pk = v ! 0
    g i = pk < v ! i
0