Submission #378514
Source Code Expand
import Control.Applicative import Control.Monad import Data.List split :: Char -> String -> [String] split delimiter target | null target = [] | null indices = [target] | otherwise = w:split delimiter rest where indices :: [Int] indices = findIndices (==delimiter) target (w,_:rest) = splitAt (head indices) target zeropad :: Int -> Int -> String zeropad digit n = (replicate (digit - length strn) '0')++strn where strn = show n solve :: [[String]] -> [[String]] solve l = restrl $ summarize $ sort $ intl l where intl :: [[String]] -> [[Int]] intl = map (adjust . map read) adjust :: [Int] -> [Int] adjust [s,e] = [s`div`5*5 , if elow==60 then (ehigh+1)*100 else et] where et = (e+4)`div`5*5 elow = et`mod`100 ehigh = et`div`100 restrl :: [[Int]] -> [[String]] restrl = map (map $ zeropad 4) summarize :: [[Int]] -> [[Int]] summarize [] = [] summarize (x:[]) = [x] summarize (x@[xs,xe]:y@[ys,ye]:z) | xe>=ys = summarize ([xs,max xe ye]:z) | otherwise = x:summarize (y:z) main = do n <- read <$> getLine l <- replicateM n $ split '-' <$> getLine putStr $ unlines $ map (intercalate "-") $ solve l
Submission Info
Submission Time | |
---|---|
Task | D - 感雨時刻の整理 |
User | mayumini |
Language | Haskell (GHC 7.4.1) |
Score | 100 |
Code Size | 1274 Byte |
Status | AC |
Exec Time | 862 ms |
Memory | 29060 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 | 36 ms | 1544 KB |
00_sample_02.txt | AC | 29 ms | 1432 KB |
00_sample_03.txt | AC | 29 ms | 1560 KB |
cho_cho_chokudai.txt | AC | 695 ms | 24852 KB |
chokudai_ga_cho.txt | AC | 727 ms | 24844 KB |
test_01.txt | AC | 34 ms | 2068 KB |
test_02.txt | AC | 33 ms | 2068 KB |
test_03.txt | AC | 34 ms | 2068 KB |
test_04.txt | AC | 33 ms | 2064 KB |
test_05.txt | AC | 35 ms | 2072 KB |
test_06.txt | AC | 34 ms | 2172 KB |
test_07.txt | AC | 33 ms | 2060 KB |
test_08.txt | AC | 33 ms | 1940 KB |
test_09.txt | AC | 44 ms | 2580 KB |
test_10.txt | AC | 45 ms | 2708 KB |
test_11.txt | AC | 42 ms | 2580 KB |
test_12.txt | AC | 40 ms | 2456 KB |
test_13.txt | AC | 40 ms | 2068 KB |
test_14.txt | AC | 44 ms | 2584 KB |
test_15.txt | AC | 45 ms | 2708 KB |
test_16.txt | AC | 34 ms | 2072 KB |
test_17.txt | AC | 43 ms | 2580 KB |
test_18.txt | AC | 35 ms | 2068 KB |
test_19.txt | AC | 40 ms | 2452 KB |
test_20.txt | AC | 41 ms | 2452 KB |
test_21.txt | AC | 851 ms | 27924 KB |
test_22.txt | AC | 853 ms | 29060 KB |
test_23.txt | AC | 848 ms | 27928 KB |
test_24.txt | AC | 855 ms | 28952 KB |
test_25.txt | AC | 855 ms | 28948 KB |
test_26.txt | AC | 862 ms | 28952 KB |
test_27.txt | AC | 791 ms | 25876 KB |
test_28.txt | AC | 849 ms | 27924 KB |
test_29.txt | AC | 30 ms | 1540 KB |
test_30.txt | AC | 33 ms | 1940 KB |
test_31.txt | AC | 147 ms | 6424 KB |
test_32.txt | AC | 33 ms | 2052 KB |
test_33.txt | AC | 556 ms | 18708 KB |
test_34.txt | AC | 31 ms | 1532 KB |
test_35.txt | AC | 37 ms | 2192 KB |
test_36.txt | AC | 856 ms | 27920 KB |
test_37.txt | AC | 850 ms | 28948 KB |
test_38.txt | AC | 856 ms | 28000 KB |
test_39.txt | AC | 850 ms | 27928 KB |
test_40.txt | AC | 849 ms | 28032 KB |
test_41.txt | AC | 729 ms | 24840 KB |
test_42.txt | AC | 854 ms | 27920 KB |
test_43.txt | AC | 719 ms | 24968 KB |