結果
問題 | No.1110 好きな歌 |
ユーザー | aoshima |
提出日時 | 2020-07-17 11:58:18 |
言語 | Haskell (9.8.2) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,030 bytes |
コンパイル時間 | 9,625 ms |
コンパイル使用メモリ | 209,428 KB |
実行使用メモリ | 37,920 KB |
最終ジャッジ日時 | 2024-05-05 22:56:12 |
合計ジャッジ時間 | 18,875 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,816 KB |
testcase_01 | AC | 1 ms
5,376 KB |
testcase_02 | AC | 1 ms
5,376 KB |
testcase_03 | AC | 1 ms
5,376 KB |
testcase_04 | AC | 1 ms
5,376 KB |
testcase_05 | AC | 1 ms
5,376 KB |
testcase_06 | AC | 1 ms
5,376 KB |
testcase_07 | AC | 1 ms
5,376 KB |
testcase_08 | AC | 1 ms
5,376 KB |
testcase_09 | AC | 1 ms
5,376 KB |
testcase_10 | AC | 2 ms
5,376 KB |
testcase_11 | AC | 2 ms
5,376 KB |
testcase_12 | AC | 2 ms
5,376 KB |
testcase_13 | AC | 1 ms
5,376 KB |
testcase_14 | AC | 8 ms
7,808 KB |
testcase_15 | AC | 5 ms
7,680 KB |
testcase_16 | AC | 8 ms
7,936 KB |
testcase_17 | AC | 16 ms
7,936 KB |
testcase_18 | AC | 2 ms
5,376 KB |
testcase_19 | AC | 17 ms
7,936 KB |
testcase_20 | AC | 14 ms
8,064 KB |
testcase_21 | AC | 6 ms
7,680 KB |
testcase_22 | AC | 12 ms
7,808 KB |
testcase_23 | AC | 4 ms
7,680 KB |
testcase_24 | TLE | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
testcase_43 | -- | - |
testcase_44 | -- | - |
testcase_45 | -- | - |
testcase_46 | -- | - |
testcase_47 | -- | - |
testcase_48 | -- | - |
testcase_49 | -- | - |
testcase_50 | -- | - |
testcase_51 | -- | - |
testcase_52 | -- | - |
testcase_53 | -- | - |
コンパイルメッセージ
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
ソースコード
import qualified Control.Arrow as Arrow import Control.Monad (replicateM) import qualified Data.List as L import qualified Data.ByteString.Char8 as BSC8 import qualified Data.Maybe as Maybe import qualified Data.Vector.Unboxed as VU getInt :: BSC8.ByteString -> Maybe (Int, BSC8.ByteString) getInt = fmap (Arrow.second BSC8.tail) . BSC8.readInt getAB :: IO (Int, Int) getAB = (\vec -> (vec VU.! 0, vec VU.! 1)) . VU.unfoldrN 2 getInt <$> BSC8.getLine main :: IO () main = do (n, d) <- getAB xs <- map (fst. Maybe.fromJust . BSC8.readInt) <$> replicateM n BSC8.getLine if n == 1 then print 0 else putStr $ unlines $ map show $ solve n d xs solve :: Int -> Int -> [Int] -> [Int] solve n d xs = map f ys where -- ys :: [(Int, [Int])] ys = part xs -- f :: (Int, [Int]) -> Int f (a, zs) = length $ filter (\x -> a - x >= d) zs part :: [Int] -> [(Int, [Int])] part [x] = [(x, [])] part (x:xs) = (x, xs) : map (\(y, ys) -> (y, x:ys)) (part xs)