Hey, 

During round 1C I got a runtime error that I'm curious about. I attached my 
code below:
Basically I create a dictionary with 1's representing possible values. This 
lets me figure out by reverse elimination which digit represents which 
values (the count in the end).
On my machine it worked with the provided input.
Thanks :) 

def dict_query(bs, value, my_dict):
    if bs not in my_dict:
        my_dict[bs] = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
    for j in range(value, 10):
        my_dict[bs][j] = 0


def logically_iterate():
    my_dict = {}
    result = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    for i in range(10000):
        whole_input = input()
        separated = whole_input.split(' ')
        if len(separated[0]) == len(separated[1]):
            dict_query(separated[1][0], int(separated[0][0]), my_dict)
        if len(separated[1]) > 1:
            if separated[1][1] not in my_dict:
                my_dict[separated[1][1]] = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]

    for key, value in my_dict.items():
        result[value.count(1)] = key
    result[0] = result[10]
    result.pop()
    return result


def main():
    num_cases = int(input())
    U = int(input())
    for i in range(num_cases):
        result = logically_iterate()
        print("Case #{}: {}".format(i+1, ''.join(result)))


main()



-- 
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 google-code+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/de076af8-26a0-40d2-a03e-0d00b989fed6%40googlegroups.com.

Reply via email to