Skip to content

Instantly share code, notes, and snippets.

@bigblind
Created April 11, 2016 15:32
Show Gist options
  • Save bigblind/1a36801e7ef7bb4c07b4566c4b386dbe to your computer and use it in GitHub Desktop.
Save bigblind/1a36801e7ef7bb4c07b4566c4b386dbe to your computer and use it in GitHub Desktop.
import sys, math
inp = open("in.txt")
out = open("out.txt","w+")
sys.stdout = out
t = int(inp.readline())
def print_case(case, result):
print "Case #%d: %s" % (case, str(result))
for tc in xrange(t):
length, complexity, students = [int(x) for x in inp.readline().split()]
if complexity == 1 and students < length:
print_case(tc+1, "IMPOSSIBLE")
continue
if students < length - 1:
print_case(tc+1, "IMPOSSIBLE")
continue
if length == 1:
print_case(tc+1, "1")
continue
l = range(2, length+1)
print_case(tc+1, " ".join(map(str, l)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment