CSES - Harjoituskisa 14.1.2018 - Results
Submission details
Task:Alitaulukot
Sender:FSMnArmosta
Submission time:2018-01-14 19:44:30 +0200
Language:Haskell
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED15
#2ACCEPTED85
Test results
testverdicttimegroup
#1ACCEPTED0.04 s1details
#2ACCEPTED0.79 s2details

Compiler report

input/code.hs:1:1: Warning:
    Top-level binding with no type signature:
      iteraatio :: forall a. Integral a => a -> a -> [a] -> a

input/code.hs:2:78: Warning:
    Defaulting the following constraint(s) to type `Integer'
      (Integral b0) arising from a use of `^' at input/code.hs:2:78
      (Num b0) arising from the literal `9' at input/code.hs:2:79
    In the first argument of `(+)', namely `10 ^ 9'
    In the second argument of `mod', namely `(10 ^ 9 + 7)'
    In the expression:
      ((k + 1) * (n - k) * a + (iteraatio (k + 1) n rest))
      `mod` (10 ^ 9 + 7)

input/code.hs:4:1: Warning:
    Top-level binding with no type signature: main :: IO ()

input/code.hs:7:10: Warning:
    Defaulting the following constraint(s) to type `Integer'
      (Integral a0)
        arising from a use of `iteraatio' at input/code.hs:7:10-18
      (Num a0) arising from the literal `0' at input/code.hs:7:20
      (Read a0) arising from a use of `read' at input/code.hs:5:30-33
      (Show a0) a...

Code

iteraatio _ _ [] = 0
iteraatio k n (a:rest) = ((k+1)*(n-k)*a + (iteraatio (k+1) n rest)) `mod` (10^9 + 7)

main = do
  n <- getLine >>= (return . read)
  nums <- getLine >>= (\l -> return (map (read) (words l)))
  print (iteraatio 0 n nums)

Test details

Test 1

Group: 1

Verdict: ACCEPTED

input
100
72 66 50 11 3 15 68 45 79 11 9...

correct output
9437440

user output
9437440

Test 2

Group: 2

Verdict: ACCEPTED

input
100000
483398076 227177515 705421329 ...

correct output
179178131

user output
179178131