Submission #212063
Source Code Expand
import Control.Applicative import Control.Monad import Data.List (sort) import Text.Printf (printf) parseTime :: String -> [Int] parseTime [h1, h2, m1, m2, _, h3, h4, m3, m4] = read <$> [[h1, h2], [m1, m2], [h3, h4], [m3, m4]] toFiveMinResolutin :: [Int] -> [Int] toFiveMinResolutin [h, m, h', m'] = let newm = m `div` 5 * 5 newm' = (m' + 4) `div` 5 * 5 in [h, newm] ++ if 60 <= newm' then [h' + 1, 0] else [h', newm'] fuseMap :: (a -> a -> Maybe a) -> [a] -> [a] fuseMap fusionFunc arr = reverse $ f [] arr where f acc [] = acc f [] (x:xs) = f [x] xs f yall@(y:ys) (x:xs) = case fusionFunc y x of Nothing -> f (x:yall) xs Just n -> f (n:ys) xs main :: IO () main = do n <- readLn inputRanges <- map parseTime <$> replicateM n getLine forM_ (fuseMap isOverlapping $ sort (toFiveMinResolutin <$> inputRanges)) printRange where isOverlapping [ash, asm, aeh, aem] [bsh, bsm, beh, bem] | [beh, bem] <= [aeh, aem] = Just [ash, asm, aeh, aem] | [bsh, bsm] <= [aeh, aem] = Just [ash, asm, beh, bem] | otherwise = Nothing printRange [a, b, c, d] = putStrLn $ printf "%02d%02d-%02d%02d" a b c d
Submission Info
Submission Time | |
---|---|
Task | D - 感雨時刻の整理 |
User | motosuke |
Language | Haskell (GHC 7.4.1) |
Score | 100 |
Code Size | 1338 Byte |
Status | AC |
Exec Time | 1126 ms |
Memory | 23644 KB |
Judge Result
Set Name | all | ||
---|---|---|---|
Score / Max Score | 100 / 100 | ||
Status |
|
Set Name | Test Cases |
---|---|
all | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, cho_cho_chokudai.txt, chokudai_ga_cho.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_01.txt | AC | 61 ms | 1364 KB |
00_sample_02.txt | AC | 26 ms | 1240 KB |
00_sample_03.txt | AC | 24 ms | 1368 KB |
cho_cho_chokudai.txt | AC | 891 ms | 21472 KB |
chokudai_ga_cho.txt | AC | 940 ms | 23512 KB |
test_01.txt | AC | 33 ms | 1752 KB |
test_02.txt | AC | 32 ms | 1748 KB |
test_03.txt | AC | 31 ms | 1824 KB |
test_04.txt | AC | 29 ms | 1752 KB |
test_05.txt | AC | 31 ms | 1756 KB |
test_06.txt | AC | 32 ms | 1776 KB |
test_07.txt | AC | 31 ms | 1808 KB |
test_08.txt | AC | 28 ms | 1648 KB |
test_09.txt | AC | 44 ms | 2264 KB |
test_10.txt | AC | 47 ms | 2316 KB |
test_11.txt | AC | 42 ms | 2140 KB |
test_12.txt | AC | 39 ms | 2136 KB |
test_13.txt | AC | 31 ms | 1880 KB |
test_14.txt | AC | 43 ms | 2328 KB |
test_15.txt | AC | 46 ms | 2396 KB |
test_16.txt | AC | 30 ms | 1816 KB |
test_17.txt | AC | 43 ms | 2268 KB |
test_18.txt | AC | 35 ms | 1896 KB |
test_19.txt | AC | 40 ms | 2128 KB |
test_20.txt | AC | 42 ms | 2132 KB |
test_21.txt | AC | 1100 ms | 23640 KB |
test_22.txt | AC | 1126 ms | 23632 KB |
test_23.txt | AC | 1095 ms | 23636 KB |
test_24.txt | AC | 1080 ms | 23636 KB |
test_25.txt | AC | 1109 ms | 23640 KB |
test_26.txt | AC | 1074 ms | 23640 KB |
test_27.txt | AC | 984 ms | 21720 KB |
test_28.txt | AC | 1071 ms | 23636 KB |
test_29.txt | AC | 26 ms | 1248 KB |
test_30.txt | AC | 28 ms | 1624 KB |
test_31.txt | AC | 176 ms | 5088 KB |
test_32.txt | AC | 27 ms | 1624 KB |
test_33.txt | AC | 714 ms | 16472 KB |
test_34.txt | AC | 29 ms | 1300 KB |
test_35.txt | AC | 35 ms | 1880 KB |
test_36.txt | AC | 1095 ms | 23644 KB |
test_37.txt | AC | 1093 ms | 23520 KB |
test_38.txt | AC | 1078 ms | 23640 KB |
test_39.txt | AC | 1094 ms | 23644 KB |
test_40.txt | AC | 1086 ms | 23640 KB |
test_41.txt | AC | 897 ms | 23644 KB |
test_42.txt | AC | 1059 ms | 23644 KB |
test_43.txt | AC | 906 ms | 22620 KB |