import sys, os, math
def readout(name):
f=open(name)
return [int(x) for x in f.read().strip().split(" ")]
def writeout(out):
print(' '.join([str(x) for x in out]))
if len(sys.argv)==2:
print(sys.argv[1])
elif len(sys.argv)==3:
out=[int(sys.argv[1]), int(sys.argv[2])]
if out[0]>out[1]: out=out[::-1]
writeout(out)
elif len(sys.argv)>1:
elems=sys.argv[1:]
os.system(f"python3 {sys.argv[0]} {' '.join(elems[:math.floor(len(elems)/2)])} > out.txt")
first=readout("out.txt")
os.system(f"python3 {sys.argv[0]} {' '.join(elems[math.floor(len(elems)/2):])} > out.txt")
second=readout("out.txt")
out=first+second
secondi=len(first)
i=0
while i<secondi:
if out[i]>out[secondi]:
out.insert(i, out.pop(secondi))
secondi=secondi+1
if secondi>=len(out): break
i=i+1
writeout(out)
def entry(elems):
os.system(f"python3 {sys.argv[0]} {' '.join([str(x) for x in elems])} > out.txt")
return readout("out.txt")
post a comment