結果

問題 No.2922 Rose Garden
ユーザー tomcat1233tomcat1233
提出日時 2024-10-12 16:44:02
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 2,197 bytes
コンパイル時間 9,949 ms
コンパイル使用メモリ 180,052 KB
実行使用メモリ 8,448 KB
最終ジャッジ日時 2024-10-12 16:44:22
合計ジャッジ時間 11,891 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
6,272 KB
testcase_01 AC 3 ms
5,248 KB
testcase_02 AC 5 ms
6,144 KB
testcase_03 AC 7 ms
8,448 KB
testcase_04 AC 5 ms
6,272 KB
testcase_05 AC 4 ms
6,144 KB
testcase_06 AC 4 ms
5,248 KB
testcase_07 AC 6 ms
7,552 KB
testcase_08 AC 2 ms
5,248 KB
testcase_09 AC 6 ms
7,808 KB
testcase_10 AC 3 ms
5,248 KB
testcase_11 AC 2 ms
5,248 KB
testcase_12 AC 5 ms
6,400 KB
testcase_13 AC 5 ms
7,040 KB
testcase_14 AC 3 ms
5,248 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 4 ms
6,912 KB
testcase_31 AC 2 ms
5,248 KB
testcase_32 AC 3 ms
5,632 KB
testcase_33 AC 2 ms
5,248 KB
testcase_34 AC 5 ms
7,424 KB
testcase_35 AC 3 ms
5,248 KB
testcase_36 AC 5 ms
8,064 KB
testcase_37 AC 6 ms
8,064 KB
testcase_38 AC 4 ms
6,528 KB
testcase_39 AC 6 ms
8,064 KB
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 AC 2 ms
5,248 KB
testcase_51 AC 2 ms
5,248 KB
testcase_52 AC 2 ms
5,248 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )

Main.hs:54:14: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from Data.List, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
54 | nubOrd = map head.group.sort
   |              ^^^^

Main.hs:62:40: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from Data.List, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
62 |   | otherwise = canJump j b h : f j h (tail hs)
   |                                        ^^^^

Main.hs:63:13: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from Data.List, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
63 |   where h = head hs
   |             ^^^^

Main.hs:70:40: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from Data.List, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
70 |   let ans = all (== True) $ f (s * b) (head hs) (tail hs)
   |                                        ^^^^

Main.hs:70:50: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from Data.List, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instea

ソースコード

diff #

import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Control.Monad.ST             
import Data.Ix
import Data.Array (Array)
import Data.Array.IArray
import Data.Array.IO             
import Data.Array.MArray          
import Data.Array.ST                
import Data.Array.Unboxed (UArray)
import Data.Char
import Data.List as L

import Data.Foldable
import Control.Exception
import Data.Array.Base (STUArray(STUArray), UArray (UArray))
import Data.ByteString.Char8 (ByteString)
import Data.Array.IO.Internals (IOUArray(IOUArray))
import Data.Ord (comparing, Down (Down))
tuplify2 :: [b] -> (b, b)
tuplify2 (x:y:_) = (x,y)
tuplify2 _ = undefined

--Input functions with ByteString
readInt :: ByteString -> Int
readInt = fst . fromJust . BS.readInt
readIntTuple :: ByteString -> (Int, Int)
readIntTuple = tuplify2 . map readInt . BS.words
readIntList :: ByteString -> [Int]
readIntList = map readInt . BS.words

getInt :: IO Int
getInt = readInt <$> BS.getLine
getIntList :: IO [Int]
getIntList = readIntList <$> BS.getLine
getIntListX :: IO [Int]
getIntListX = readIntList <$> BS.getContents
getIntNList :: Integral a => a -> IO [[Int]]
getIntNList n = map readIntList <$> replicateM (fromIntegral n) BS.getLine
getIntMatrix :: IO [[Int]]
getIntMatrix = map readIntList . BS.lines <$> BS.getContents
getIntTuple :: IO (Int, Int)
getIntTuple = readIntTuple <$> BS.getLine
getIntNTuples :: Integral a => a -> IO [(Int, Int)]
getIntNTuples n = map readIntTuple <$> replicateM (fromIntegral n) BS.getLine
getIntTuples :: IO [(Int, Int)]
getIntTuples = map readIntTuple . BS.lines <$> BS.getContents
putYesNo :: Bool -> IO ()
putYesNo bl = putStrLn $ if bl then "Yes" else "No"
putInts :: [Int] -> IO ()
putInts x = putStrLn $ unwords $ map show x
nubOrd :: Eq a => Ord a => [a] -> [a]
nubOrd = map head.group.sort

canJump :: Int -> Int -> Int -> Bool
canJump j now next = now + j >= next

f :: Int -> Int -> [Int] -> [Bool]
f j b hs
  | null hs = []
  | otherwise = canJump j b h : f j h (tail hs)
  where h = head hs

 
main :: IO ()
main = do
  [n, s, b] <- getIntList
  hs <- getIntList
  let ans = all (== True) $ f (s * b) (head hs) (tail hs)
  putYesNo ans
0