A program-comparer Based on PyQt5.
writeln
Pass in a list and write it on one line.
from random import randint
def randPair(a, b):
l = randint(a, b)
r = randint(a, b)
return (l, r) if l < r else (r, l)
def setData(writeln, id=1):
a = randint(1, 2e9)
b = randint(1, 2e9)
writeln([a, b])
This is a program-comparer for programming competition. It's base on cyaron
, but some simple encapsulation was made.
- Copy
ProgramCompare.py
to you workspace. - New a python file and write
from ProgramCompare import *
- New a
ProgramCompare
class and appoint thestd_cpp
path and thecmp_cpp
path. - Write the
setData
methods, it is a function object for making data according to the problem.
compare
using os.popen()
to get the output from two exe files and comparing the text of two.
If you only want to gain test.in
and test.out
as data from std_exe
, you can use makeData
.
######## make data
compare.makeData(1e1)
compare.makeData(1e2)
compare.makeData(1e3)
compare.makeData(1e4)
compare.makeData(1e5)
If there is a boundary, an error will occur when the data is greater than it, and no error will occur when it is not greater than it. You can use lower_bound
to find this boundary