I've solved D-small correctly, and after two days I thought I cracked D-large.
My code is rather lengthy, but it follows this idea:
If the length is 1, output "0? 0" or "1? 1" - depending on the "bad" string.
If the length > 1,
If the "bad" string is entirely composed of "1"s, then write the answer as
"?" x (length - 1) + " " + "10?" + "10" x (length - 1). It worked (I submitted
it for D-small).
If the "bad" string consists of "0"s and "1"s, then do the following:
Find the earliest index at which the "bad" string differs with ALL of the
"good" strings. For instance, with the combination G: "001 010", B: "100", the
index would be 0, since ALL of the "good" strings start with a different digit
than the "bad" string.
Format the answer as follows: "?" x (length - 1) + " " + "10" x (index - 1)
+ /the character of the good string at the index/ + "10" x (l - index + 1).
The idea is as follows: I want, at the index when ALL of the "good" strings and
the "bad" string differ, to let the program output ONLY the digit that appears
in the "good" strings at that index.
For instance, if
G = 1000 1010 0110
B = 1011
the index is 3 (the 4th digit).
We don't have ANY reason to let our program output "1" as the final digit, so
we force it to output a "0" by creating the program ??? 1010100?
Similarly, if
G = 101 010 000
B = 100
it is IMPOSSIBLE to create a program, because at every index a digit of at
least one of the "good" strings and the "bad" string matches.
What's wrong with my reasoning?
Sincerely,
Vladimirr
--
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/7ccbcf89-e92f-470b-a154-f2baf6c57446%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.