CSES - HIIT Open 2018 - Results
Submission details
Task:HIIT Generation
Sender:Puhi~
Submission time:2018-05-26 11:54:16
Language:Haskell
Status:READY
Result:
Test results
testverdicttime
#1ACCEPTED0.06 sdetails
#2--details
#3ACCEPTED0.05 sdetails
#4ACCEPTED0.01 sdetails

Compiler report

input/code.hs:1:1: warning: [-Wmissing-signatures]
    Top-level binding with no type signature: main :: IO ()

input/code.hs:2:5: warning: [-Wunused-do-bind]
    A do-notation statement discarded a result of type `String'
    Suppress this warning by saying `_ <- getLine'

input/code.hs:10:1: warning: [-Wmissing-signatures]
    Top-level binding with no type signature:
      asd :: Foldable t => t Char -> Char -> [Char]

input/code.hs:13:1: warning: [-Wmissing-signatures]
    Top-level binding with no type signature: hiit :: [Char]

Code

main = do
    getLine
    c <- getContents
    putStrLn $ solve $ map head $ lines c

solve :: [Char] -> String
solve =
    foldl asd hiit

asd t x =
    concatMap (\c -> if c == x then hiit else [c]) t
    
hiit = "HIIT"

Test details

Test 1

Verdict: ACCEPTED

input
17
I
I
I
I
...

correct output
HHHHHHHHHHHHHHHHHHIITHIITTHHII...

user output
HHHHHHHHHHHHHHHHHHIITHIITTHHII...

Test 2

Verdict:

input
333332
H
H
H
H
...

correct output
HIITIITIITIITIITIITIITIITIITII...

user output
(empty)

Test 3

Verdict: ACCEPTED

input
24
H
T
H
T
...

correct output
HIIHIITIIHIIHIITIIHIITIIHIIHII...

user output
HIIHIITIIHIIHIITIIHIITIIHIIHII...

Test 4

Verdict: ACCEPTED

input
0

correct output
HIIT

user output
HIIT