結果

問題 No.1205 Eye Drops
ユーザー ducktail
提出日時 2024-05-05 19:18:25
言語 Haskell
(9.10.1)
結果
AC  
実行時間 537 ms / 2,000 ms
コード長 374 bytes
コンパイル時間 5,031 ms
コンパイル使用メモリ 171,648 KB
実行使用メモリ 114,176 KB
最終ジャッジ日時 2024-11-27 19:43:12
合計ジャッジ時間 9,395 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 37
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 Control.Monad

main :: IO ()
main = do
  [_, m] <- f
  solve <$> replicateM m f >>= putStrLn
  where
    f = map read <$> words <$> getLine

solve :: [[Int]] -> String
solve = maybe "No" (const "Yes") . foldl f (Just (0, 0))
  where
    f tp [ti, pi] = do
      (tn, pn) <- tp
      guard $ (ti - tn) >= abs (pi - pn)
      return (ti, pi)
0