Task: | Fraktaali |
Sender: | FSMnArmosta |
Submission time: | 2017-10-02 13:28:39 +0300 |
Language: | Haskell |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 10 |
#2 | ACCEPTED | 10 |
#3 | ACCEPTED | 10 |
#4 | ACCEPTED | 10 |
#5 | ACCEPTED | 10 |
#6 | ACCEPTED | 10 |
#7 | ACCEPTED | 10 |
#8 | ACCEPTED | 10 |
#9 | ACCEPTED | 10 |
#10 | ACCEPTED | 10 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.04 s | 1 | details |
#2 | ACCEPTED | 0.05 s | 2 | details |
#3 | ACCEPTED | 0.04 s | 3 | details |
#4 | ACCEPTED | 0.03 s | 4 | details |
#5 | ACCEPTED | 0.04 s | 5 | details |
#6 | ACCEPTED | 0.05 s | 6 | details |
#7 | ACCEPTED | 0.06 s | 7 | details |
#8 | ACCEPTED | 0.06 s | 8 | details |
#9 | ACCEPTED | 0.09 s | 9 | details |
#10 | ACCEPTED | 0.27 s | 10 | details |
Compiler report
input/code.hs:10:11: Warning: This binding for `flip' shadows the existing binding imported from `Prelude' at input/code.hs:1:1 (and originally defined in `GHC.Base') input/code.hs:14:1: Warning: Top-level binding with no type signature: line :: Int -> Int -> [Char] input/code.hs:16:23: Warning: This binding for `y' shadows the existing binding bound at input/code.hs:14:6 input/code.hs:17:23: Warning: This binding for `y' shadows the existing binding bound at input/code.hs:14:6 input/code.hs:22:17: Warning: Defaulting the following constraint(s) to type `Integer' (Integral b0) arising from a use of `^' at input/code.hs:22:17 (Num b0) arising from a use of `-' at input/code.hs:22:30 (Read b0) arising from a use of `read' at input/code.hs:22:20-23 In the expression: 2 ^ ((read num) - 1) In an equation for `side': side = 2 ^ ((read num) - 1) In the expression: do { num <- getLine; let sid...
Code
import Data.List lowerRight :: Int -> Int -> Int -> Bool lowerRight x y side = ((2*x `div` side) >= 1) && ((2*y `div` side) >= 1) on :: (Int, Int) -> Int -> Bool on (0, 0) 1 = False on (x, y) 2 = lowerRight x y 2 on (x, y) side = if flip then not underlying else underlying where flip = lowerRight x y side halfside = side `div` 2 underlying = on ((x `rem` halfside), (y `rem` halfside)) halfside line y width = Data.List.intercalate "" (map (charFor) coords) where coords = [0..(width-1)] `zip` (Data.List.replicate width y) boolFor (x, y) = on (x, y) width charFor (x, y) = if boolFor (x, y) then "." else "#" main :: IO () main = do num <- getLine let side = 2^((read num) - 1) let y = [0..(side-1)] let linewrap y = line y side let linelist = map (linewrap) y putStrLn (unlines linelist)
Test details
Test 1
Group: 1
Verdict: ACCEPTED
input |
---|
1 |
correct output |
---|
# |
user output |
---|
# |
Test 2
Group: 2
Verdict: ACCEPTED
input |
---|
2 |
correct output |
---|
## #. |
user output |
---|
## #. |
Test 3
Group: 3
Verdict: ACCEPTED
input |
---|
3 |
correct output |
---|
#### #.#. ##.. #..# |
user output |
---|
#### #.#. ##.. #..# |
Test 4
Group: 4
Verdict: ACCEPTED
input |
---|
4 |
correct output |
---|
######## #.#.#.#. ##..##.. #..##..# ####.... ... |
user output |
---|
######## #.#.#.#. ##..##.. #..##..# ####.... ... |
Test 5
Group: 5
Verdict: ACCEPTED
input |
---|
5 |
correct output |
---|
################ #.#.#.#.#.#.#.#. ##..##..##..##.. #..##..##..##..# ####....####.... ... |
user output |
---|
################ #.#.#.#.#.#.#.#. ##..##..##..##.. #..##..##..##..# ####....####.... ... |
Test 6
Group: 6
Verdict: ACCEPTED
input |
---|
6 |
correct output |
---|
##############################... |
user output |
---|
##############################... |
Test 7
Group: 7
Verdict: ACCEPTED
input |
---|
7 |
correct output |
---|
##############################... |
user output |
---|
##############################... |
Test 8
Group: 8
Verdict: ACCEPTED
input |
---|
8 |
correct output |
---|
##############################... |
user output |
---|
##############################... |
Test 9
Group: 9
Verdict: ACCEPTED
input |
---|
9 |
correct output |
---|
##############################... |
user output |
---|
##############################... |
Test 10
Group: 10
Verdict: ACCEPTED
input |
---|
10 |
correct output |
---|
##############################... |
user output |
---|
##############################... |