Skip to content

Instantly share code, notes, and snippets.

@misakar
Created December 21, 2016 15:33
Show Gist options
  • Save misakar/92a120705fc690232b04a9ab86e7efd7 to your computer and use it in GitHub Desktop.
Save misakar/92a120705fc690232b04a9ab86e7efd7 to your computer and use it in GitHub Desktop.
pat1045
def handle(real_inputs, sort_inputs, output):
index = 0
while (index != n):
if (real_inputs[index] == sort_inputs[index]):
output.append(real_inputs[index])
index += 1
else: index = sort_inputs.index(real_inputs[index])+1
if __name__ == '__main__':
#n = input()
#inputs = raw_input()
output = []
#real_inputs = [int(each) for each in inputs.split()]
n = 100000
real_inputs = range(1, 100001)
sort_inputs = sorted(real_inputs)
handle(real_inputs, sort_inputs, output)
if len(output) != 0:
print len(output)
for ob in output:
print ob,
else: print '0\n'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment