Submission #288852
Source Code Expand
import Control.Applicative import Control.Monad import Data.Set import Text.Printf data Period = Period Int Int deriving (Eq, Ord) instance Show Period where show (Period st en) = printf "%04d-%04d" (toHM st) (toHM en) instance Read Period where readsPrec _ s = [(Period ((read . take 4) s) ((read . drop 5) s), [])] main :: IO () main = do num <- read <$> getLine ps <- (reverse . (foldl' mergeEntries []) . fromList) <$> ((replicateM num) $ (roundPeriod . read) <$> getLine) mapM_ putStrLn (Prelude.map show ps) toMinute :: Int -> Int toMinute x = (h * 60) + m where h = x `div` 100 m = x - (h * 100) toHM :: Int -> Int toHM x = (h * 100) + m where h = x `div` 60 m = x - (h * 60) roundPeriod :: Period -> Period roundPeriod (Period st en) = Period ((st `div` 5) * 5) (((en + 4) `div` 5) * 5) mergeEntries :: [Period] -> Period -> [Period] mergeEntries [] p = [p] mergeEntries all@(hp@(Period hst hen) : ps) p@(Period pst pen) | pst > hen = p : all | otherwise = Period (min hst pst) (max hen pen) : ps
Submission Info
Submission Time | |
---|---|
Task | D - 感雨時刻の整理 |
User | fujiyan |
Language | Haskell (GHC 7.4.1) |
Score | 0 |
Code Size | 1112 Byte |
Status | WA |
Exec Time | 670 ms |
Memory | 24864 KB |
Judge Result
Set Name | all | ||
---|---|---|---|
Score / Max Score | 0 / 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 | WA | 49 ms | 1436 KB |
00_sample_02.txt | WA | 27 ms | 1416 KB |
00_sample_03.txt | WA | 28 ms | 1432 KB |
cho_cho_chokudai.txt | WA | 514 ms | 20772 KB |
chokudai_ga_cho.txt | WA | 550 ms | 21524 KB |
test_01.txt | WA | 33 ms | 1944 KB |
test_02.txt | WA | 32 ms | 1940 KB |
test_03.txt | WA | 31 ms | 1944 KB |
test_04.txt | WA | 33 ms | 1944 KB |
test_05.txt | WA | 32 ms | 1944 KB |
test_06.txt | WA | 36 ms | 2064 KB |
test_07.txt | WA | 34 ms | 1944 KB |
test_08.txt | WA | 33 ms | 1944 KB |
test_09.txt | WA | 39 ms | 2224 KB |
test_10.txt | WA | 37 ms | 2328 KB |
test_11.txt | WA | 36 ms | 2200 KB |
test_12.txt | WA | 36 ms | 2200 KB |
test_13.txt | WA | 33 ms | 2068 KB |
test_14.txt | WA | 41 ms | 2328 KB |
test_15.txt | WA | 49 ms | 2400 KB |
test_16.txt | WA | 35 ms | 2080 KB |
test_17.txt | WA | 43 ms | 2264 KB |
test_18.txt | WA | 34 ms | 2076 KB |
test_19.txt | WA | 40 ms | 2128 KB |
test_20.txt | WA | 40 ms | 2280 KB |
test_21.txt | WA | 599 ms | 23452 KB |
test_22.txt | WA | 626 ms | 23964 KB |
test_23.txt | WA | 613 ms | 23708 KB |
test_24.txt | WA | 612 ms | 23964 KB |
test_25.txt | WA | 623 ms | 24040 KB |
test_26.txt | WA | 539 ms | 20760 KB |
test_27.txt | WA | 512 ms | 20756 KB |
test_28.txt | WA | 546 ms | 20756 KB |
test_29.txt | WA | 29 ms | 1368 KB |
test_30.txt | WA | 31 ms | 1816 KB |
test_31.txt | WA | 104 ms | 4700 KB |
test_32.txt | WA | 30 ms | 1816 KB |
test_33.txt | WA | 364 ms | 14612 KB |
test_34.txt | WA | 28 ms | 1368 KB |
test_35.txt | WA | 33 ms | 2000 KB |
test_36.txt | WA | 670 ms | 24864 KB |
test_37.txt | WA | 553 ms | 20760 KB |
test_38.txt | WA | 539 ms | 20760 KB |
test_39.txt | WA | 557 ms | 20888 KB |
test_40.txt | WA | 551 ms | 20832 KB |
test_41.txt | WA | 516 ms | 20764 KB |
test_42.txt | WA | 529 ms | 20772 KB |
test_43.txt | WA | 518 ms | 20768 KB |