def test_problem(): p = _.problem("10-A") eq(p["input"], "standard input") eq(p["output"], "standard output") eq(p["memory"], "256 megabytes") eq(p["time"], "1 second") eq(p["tests"][0], ("1 3 2 1 5 10\n0 10", "30")) eq(p["tests"][1], ("2 8 4 2 5 10\n20 30\n50 100", "570"))
import parse, cache, itertools, files link = parse.base + 'classical/sort=0,start=' prev = cache.load_prev() codes_old = [] for i in itertools.count(start=prev + 1): src = parse.get_source(link + str(i*50)) codes = parse.get_codes(src) if codes == codes_old: break codes_old = codes names, probs, users = cache.load() for p, code in enumerate(codes): parse.print_progress(i, p + 1) parse.problem(code, names, probs, users) if len(codes) == 50: cache.dump(i, names, probs, users) for code, name in names.items(): names[code] = name.encode('utf-8') files.clear() files.write(names, probs, users)