I am trying to figure out what is wrong with my solution to problem D.
It was marked as incorrect, yet I can't fault it.
I figured it should be possible to create a set of programs which can output
any string with at least one zero and must output at least one zero.
So All the program does is check if the Bad string is in the good list, if it
is it outputs "IMPOSSIBLE" and otherwise it outputs
the first program with L-1 "?" and the second program with "10" repeated 50
times followed by "?1".
Totally ignoring the good list beyond impossibility check.
My Scala code (for a single test):
val Array(n,l) =in.readLine().split(" ").map(_.toInt)
val good = in.readLine().split(" ")
val bad = in.readLine()
if (good.contains(bad)) "IMPOSSIBLE" else {
"?"*(l-1) + " " + ("10"*50+ "?" + "1")
}
It obviously must produce at least one zero as one program has the string "0?"
and the other program has no "1" to get in-between.
And for any string with at least one zero, we can have the last 0 be output by
the the "0?" sub-sequence any trailing 1s with the final 1 and a correct number
of "?" from the first program. and with alternating "10" of sufficient length
and the "?" from first program it should be possible to produce any prefix.
What is wrong with my analysis/code?
Thanks,
Meir
--
You received this message because you are subscribed to the Google Groups
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-code/d75bc571-aaa0-47cd-bd5c-73b637fbd2d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.