Skip to content

Instantly share code, notes, and snippets.

@luqmaan
Created June 23, 2013 19:37
Show Gist options
  • Save luqmaan/5846252 to your computer and use it in GitHub Desktop.
Save luqmaan/5846252 to your computer and use it in GitHub Desktop.
Generates a big test file for the Sort! Sort!! and Sort!!! problem from UVA Online Judge. http://uva.onlinejudge.org/index.php?option=onlinejudge&page=show_problem&problem=2296
#!/usr/bin/env python
import random
fname = 'test-input.txt'
fout = None
debug = False
def write(out):
global fout
if out == '0 0':
fout.write(str(out))
else:
fout.write(str(out) + '\n')
if debug:
print str(out)
def write_set():
M = random.randint(0, 1000000)
N = 1000000
write('%d %d' % (N, M))
for i in range(0, N):
write(random.randint(-1000000, 1000000))
def main():
global fout
fout = open(fname, 'w')
random.seed(9290293289109483)
for i in range(0, 1):
write_set()
write('0 0')
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment