Created
June 23, 2013 19:37
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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