Ejemplo n.º 1
0
def main():
    inputfile = FileParser()
    T = inputfile.read_int()
    for test in range(1, T + 1):
        N = inputfile.read_int()

        senators = inputfile.read_integers()

        result = solve(senators)

        print "Case #{}: {}".format(test, " ".join(result))
Ejemplo n.º 2
0
def main():
    inputfile = FileParser()
    T = inputfile.read_int()
    for test in range(1, T + 1):
        B, M = inputfile.read_integers()

        solution = solve(B, M)

        if solution is None:
            print "Case #{}: IMPOSSIBLE".format(test)
        else:
            print "Case #{}: POSSIBLE".format(test)
            for row in solution:
                print "".join(["1" if x else "0" for x in row])
                pass
Ejemplo n.º 3
0
def main():
    inputfile = FileParser()
    T = inputfile.read_int()
    for test in range(1, T + 1):
        J, P, S, K = inputfile.read_integers()

        solution = solve(J, P, S, K)

        assert len(solution) <= 1000
        assert len(solution) <= J * P * S
        assert len(solution) >= 1

        print "Case #{}: {}".format(test, len(solution))
        for j, p, s in solution:
            print "{} {} {}".format(j+1, p+1, s+1)