Task: | Ruudukko |
Sender: | PauliK |
Submission time: | 2019-10-01 20:58:36 +0300 |
Language: | Haskell |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 100 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.01 s | details |
#2 | ACCEPTED | 0.01 s | details |
#3 | ACCEPTED | 0.01 s | details |
#4 | ACCEPTED | 0.01 s | details |
#5 | ACCEPTED | 0.05 s | details |
#6 | ACCEPTED | 0.05 s | details |
Compiler report
input/code.hs:7:1: warning: [-Wmissing-signatures] Top-level binding with no type signature: splitToPairs :: Int -> [t] -> [[t]] input/code.hs:9:1: warning: [-Wtabs] Tab character found here, and in 9 further locations. Please use spaces instead. input/code.hs:12:1: warning: [-Wmissing-signatures] Top-level binding with no type signature: doRow :: Int -> [a] -> [a] input/code.hs:14:1: warning: [-Wunused-top-binds] Defined but not used: `make4x4From' input/code.hs:14:1: warning: [-Wmissing-signatures] Top-level binding with no type signature: make4x4From :: (Enum t, Num t) => t -> [[t]] input/code.hs:21:1: warning: [-Wunused-top-binds] Defined but not used: `horizCat' input/code.hs:21:1: warning: [-Wmissing-signatures] Top-level binding with no type signature: horizCat :: [[a]] -> [[a]] -> [[a]] input/code.hs:22:1: warning: [-Wunused-top-binds] Defined but not used: `vertCat' input/code.hs:22:1: warning: [-Wmissing-sig...
Code
import Data.Functionimport Data.Listimport Data.Monoidimport Data.Foldableimport Data.BitssplitToPairs _ [] = []splitToPairs n xs = pair : splitToPairs n restwhere(pair, rest) = splitAt n xsdoRow n xs = splitToPairs n xs & map reverse & concatmake4x4From n =let a = [n .. n + 3] inlet b = doRow 2 a inlet c = doRow 4 b inlet d = doRow 2 c in[a, b, c, d]horizCat = zipWith (++)vertCat xs ys = horizCat (transpose xs) (transpose ys) & transposedoRows xs = fold ((Endo . doRow) <$> xs) & appEndonthInSeq n = -(-n `xor` n)-- OEIS A171977theSequence :: Int -> [Int]theSequence n = [1..n] & map nthInSeqrowFuncs n = theSequence (n - 1) & inits & map doRowsmakeGrid n = rowFuncs n & map ($ [1..n])trimGrid n xs = xs & map (take n) & take nprintGridLn xs = xs & map show & intercalate " " & putStrLnprintGrid xs = xs & map printGridLn & sequence_main = don <- readLn :: IO IntmakeGrid 128 & trimGrid n & printGrid-- makeGrid 128 & trimGrid n & concat & sum & print
Test details
Test 1
Verdict: ACCEPTED
input |
---|
1 |
correct output |
---|
1 |
user output |
---|
1 |
Test 2
Verdict: ACCEPTED
input |
---|
2 |
correct output |
---|
1 2 2 1 |
user output |
---|
1 2 2 1 |
Test 3
Verdict: ACCEPTED
input |
---|
5 |
correct output |
---|
1 2 3 4 5 2 1 4 3 6 3 4 1 2 7 4 3 2 1 8 5 6 7 8 1 |
user output |
---|
1 2 3 4 5 2 1 4 3 6 3 4 1 2 7 4 3 2 1 8 5 6 7 8 1 |
Test 4
Verdict: ACCEPTED
input |
---|
42 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... Truncated |
Test 5
Verdict: ACCEPTED
input |
---|
99 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... Truncated |
Test 6
Verdict: ACCEPTED
input |
---|
100 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... Truncated |