all stats

thomasqm's stats

guessed the most

namecorrect guessesgames togetherratio

were guessed the most by

namecorrect guessesgames togetherratio

entries

round #1

guesses
comments 0

post a comment


623743560650588202-thomasqm.py ASCII text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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")