結果

問題 No.3773 mod A > mod B
コンテスト
ユーザー norioc
提出日時 2026-10-25 12:29:23
言語 Haskell
(9.14.1 + ACL)
コンパイル:
ghc -rtsopts -with-rtsopts=-K1G -o a.out -O2 _filename_
実行:
./a.out
結果
AC  
実行時間 2 ms / 2,000 ms
+ 852µs
コード長 1,662 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 10,664 ms
コンパイル使用メモリ 220,288 KB
実行使用メモリ 9,892 KB
最終ジャッジ日時 2026-10-25 12:29:36
合計ジャッジ時間 12,771 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge7_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.14.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #
raw source code

{-# LANGUAGE BlockArguments #-}
{-# OPTIONS_GHC -Wno-unused-imports #-}
{-# OPTIONS_GHC -Wno-unused-top-binds #-}
{-# OPTIONS_GHC -Wno-missing-signatures #-}

import Control.Monad
import Control.Monad.State.Strict
import Control.Applicative
import Data.Bool
import Data.Function
import Data.List
import Data.Ord
import Data.List.Split
import Debug.Trace
import qualified Data.Char as C
-- import qualified Data.Set as Set
-- import qualified Data.Map.Strict as M
import qualified Data.ByteString.Char8 as BS
import qualified Data.Vector as V

input = getLine :: IO String
ii = readLn :: IO Int
li = unfoldr (BS.readInt . BS.dropWhile C.isSpace) <$> BS.getLine

printYn b = putStrLn $ bool "No" "Yes" b

printList :: Show a => [a] -> IO ()
printList = putStrLn . unwords . map show
puts = putStrLn

divmod x y = (x `div` y, x `mod` y)

rep = replicate
repM :: Applicative m => Int -> m a -> m [a]
repM = replicateM
repM_ :: Applicative m => Int -> m a -> m ()
repM_ = replicateM_

-- chunksOf
chunkBy = groupBy

fold :: Foldable t => (b -> a -> b) -> b -> t a -> b
fold = foldl'

pairwise :: [a] -> [(a, a)]
pairwise xs = zip xs (drop 1 xs)

windows :: Int -> [a] -> [[a]]
windows size xs
  | length w < size = []
  | otherwise = w : windows size (drop 1 xs)
  where
    w = take size xs

countIf f = length . filter f

minmax (x:xs) = foldl' f (x, x) xs
  where
    f (mi, ma) x = (min mi x, max ma x)

class Indexable c where
  at :: Int -> c a -> a

instance Indexable [] where
  at i xs = xs !! i

instance Indexable V.Vector where
  at i v = v V.! i

main = do
  [n, a, b] <- li
  let f x = (x `mod` a) > (x `mod` b)
  let ans = countIf f [1..n]
  print ans
0