from common import get_sources, run_source, score, compile_all, cpp_compile, problem_name if __name__ == '__main__': parser = argparse.ArgumentParser(description='Get scores') parser.add_argument('people', type=str, nargs='*') parser.add_argument('--all', dest='all', action='store_true') args = parser.parse_args() if not args.all and args.people == []: parser.print_help() exit(0) Sources = get_sources() if not args.all: Sources = list(set(Sources) & set(args.people)) for source in Sources: cpp_compile(source) TESTS = int(input("TESTS = ")) MAXN = int(input("MAXN = ")) MAXK = int(input("MAXK = ")) MAXX = int(input("MAXX = ")) MAXY = int(input("MAXY = ")) MAXPART = int(input("MAXPART = ")) MAXV = int(input("MAXV = ")) try: shutil.rmtree('./tmp', ignore_errors=False) except: pass os.mkdir('./tmp') for test in range(1, TESTS + 1):
from sys import stdout if __name__ == '__main__': parser = argparse.ArgumentParser(description='Get scores') parser.add_argument('people', type=str, nargs='*') parser.add_argument('--all', dest='all', action='store_true') args = parser.parse_args() if not args.all and args.people == []: parser.print_help() exit(0) SOURCES = get_sources() if not args.all: SOURCES = list(set(SOURCES) & set(args.people)) for source in SOURCES: cpp_compile(source) try: shutil.rmtree('./tmp', ignore_errors=False) except: pass os.mkdir('./tmp') TESTS = [ test.name[:-3] for test in os.scandir('./teste') if test.name[-3:] == '.in' ] SCORES = {source: 0 for source in SOURCES} RESULTS = {source: [] for source in SOURCES} for test in range(len(TESTS)): print(".", end="")
subprocess.check_call(["./"+gen_name()] + ARGS, stdout=open(temp_in(test), "w")) print("Done generating in for {}".format(test), flush=True) print("Running {} for {}".format(official_source_name(),test), flush=True) if run_source(official_source_name(), test, True) == False: print("Source error on test {}".format(test)) exit(1) testno = "./teste/%d-" % test subprocess.check_call(["cp", temp_in(test), testno+problem_name()+".in"]) subprocess.check_call(["cp", temp_out(official_source_name(), test), testno+problem_name()+".ok"]) print("Done generating ok for {}".format(test), flush=True) if __name__ == '__main__': cpp_compile(official_source_name()) try: shutil.rmtree('./tmp', ignore_errors=False) shutil.rmtree('/tmp/gen', ignore_errors=False) except: pass os.mkdir('./tmp') TESTS = [line.strip() for line in open("./teste/teste.txt") if len(line.strip()) > 0 and line.strip()[0] != '#'] try: futs = [] with concurrent.futures.ProcessPoolExecutor() as executor: for i in range(len(TESTS)): futs.append(executor.submit(gen, i)) for f in futs: