| Task: | Merkkijono |
| Sender: | FSMnArmosta |
| Submission time: | 2017-10-08 15:39:42 +0300 |
| Language: | Haskell |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | RUNTIME ERROR | 0 |
| test | verdict | time | |
|---|---|---|---|
| #1 | RUNTIME ERROR | 0.07 s | details |
| #2 | RUNTIME ERROR | 0.07 s | details |
| #3 | RUNTIME ERROR | 0.07 s | details |
| #4 | RUNTIME ERROR | 0.04 s | details |
| #5 | RUNTIME ERROR | 0.04 s | details |
| #6 | RUNTIME ERROR | 0.05 s | details |
| #7 | RUNTIME ERROR | 0.04 s | details |
| #8 | RUNTIME ERROR | 0.04 s | details |
| #9 | RUNTIME ERROR | 0.05 s | details |
| #10 | RUNTIME ERROR | 0.05 s | details |
Compiler report
input/code.hs:4:1: Warning:
Top-level binding with no type signature:
combinations :: forall a a1.
(Integral a, Num a1) =>
a1 -> a1 -> a1 -> a -> a1
input/code.hs:4:20: Warning: Defined but not used: `potential0'
input/code.hs:4:31: Warning: Defined but not used: `potential1'
input/code.hs:12:1: Warning:
Top-level binding with no type signature:
startingPoint :: forall a a1 b.
(Integral b, Num a, Num a1, Ord a) =>
a -> a -> b -> a1
input/code.hs:12:41: Warning:
Defaulting the following constraint(s) to type `Integer'
(Integral a0)
arising from a use of `combinations' at input/code.hs:12:41-52
(Num a0) arising from the literal `1' at input/code.hs:12:68
In the first argument of `(>)', namely
`combinations tentative 0 1 1'
In the expression: combinations tentative 0 1 1 > target
In the expression:
if combinations tentative 0 1...Code
import Numeric (showIntAtBase)
import Data.Char (intToDigit)
combinations soFar potential0 potential1 0 = soFar
combinations soFar potential0 potential1 bitstring =
if bit == 0
then combinations (soFar + potential0) potential0 (potential1 + potential0) rest
else combinations (soFar + potential1) (potential0 + potential1) potential1 rest
where bit = bitstring `rem` 2
rest = bitstring `div` 2
startingPoint current target layer = if combinations tentative 0 1 1 > target then 2^(layer-1) else startingPoint tentative target (layer + 1)
where tentative = if combinations (current * 2 + 1) 0 1 1 > combinations (current * 2) 0 1 1 then current * 2 + 1 else current * 2
search current target = if combinations 0 1 1 current == target then current else search (current + 1) target
main :: IO ()
main = do
num <- getLine
let target = read num :: Int
putStrLn (showIntAtBase 2 intToDigit (search (startingPoint 1 target 1) target) "")
Test details
Test 1
Verdict: RUNTIME ERROR
| input |
|---|
| ABABABABABABABABABABABABABABAB... |
| correct output |
|---|
| ABABABABABABABABABABABABABABAB... |
| user output |
|---|
| (empty) |
Error:
code: Prelude.read: no parse
Test 2
Verdict: RUNTIME ERROR
| input |
|---|
| AABBAABBAABBAABBAABBAABBAABBAA... |
| correct output |
|---|
| (empty) |
| user output |
|---|
| (empty) |
Error:
code: Prelude.read: no parse
Test 3
Verdict: RUNTIME ERROR
| input |
|---|
| ABABABABABABABABABABABABABABAB... |
| correct output |
|---|
| (empty) |
| user output |
|---|
| (empty) |
Error:
code: Prelude.read: no parse
Test 4
Verdict: RUNTIME ERROR
| input |
|---|
| BBABABBBBBAABBBABABABBBBAAABAB... |
| correct output |
|---|
| BAB |
| user output |
|---|
| (empty) |
Error:
code: Prelude.read: no parse
Test 5
Verdict: RUNTIME ERROR
| input |
|---|
| ACDCBBACDBBBACAACBBDBADBAABABA... |
| correct output |
|---|
| ACDCACDADBADABACACDCADADABABCA... |
| user output |
|---|
| (empty) |
Error:
code: Prelude.read: no parse
Test 6
Verdict: RUNTIME ERROR
| input |
|---|
| EETFHIJOGACDHMGVFJCMETMZDEITTR... |
| correct output |
|---|
| TFHIJOGACDHMGVFJCMETMZDEIROTET... |
| user output |
|---|
| (empty) |
Error:
code: Prelude.read: no parse
Test 7
Verdict: RUNTIME ERROR
| input |
|---|
| GOONLAHLYPRFCZKIKSJWAWWYJJPCDB... |
| correct output |
|---|
| GNLAHLYPRFCZKIKSJWAYPCDNWYMRCE... |
| user output |
|---|
| (empty) |
Error:
code: Prelude.read: no parse
Test 8
Verdict: RUNTIME ERROR
| input |
|---|
| PISHWMOTCDDZFRMYMOMYDYYGJZIQHS... |
| correct output |
|---|
| PISHWMOTCZFRMYMOMYDGJZIQHSVAOK... |
| user output |
|---|
| (empty) |
Error:
code: Prelude.read: no parse
Test 9
Verdict: RUNTIME ERROR
| input |
|---|
| QUVVTPXAMWWODFXRONJODPGBTCISGM... |
| correct output |
|---|
| QUTPXAMODFXRONJODPGBTCISGMVRBW... |
| user output |
|---|
| (empty) |
Error:
code: Prelude.read: no parse
Test 10
Verdict: RUNTIME ERROR
| input |
|---|
| POXHAHYEZTLYNFSLABODMRNKDSKROZ... |
| correct output |
|---|
| POXHAHYEZTLYNFSLABODMRNKDSKROZ... |
| user output |
|---|
| (empty) |
Error:
code: Prelude.read: no parse
