示例#1
0
def daemon():
    def callback(ch, method, properties, body):
        print " [x] Received judge request %r" % (body, )  # for debug
        s = Sub()
        try:
            s.getSub(body)
            c = Compile()
            c.compile(s)
        except Exception, e:
            print 'compile err| ', Exception, ':', e  # for debug

        if s.status == jcnf.SUB_STATUS['judging']:
            try:
                j = Judge()
                j.judge(s)
            except Exception, e:
                print 'judge err| ', Exception, ':', e  # for debug
示例#2
0
文件: jari.py 项目: Mr-Phoebe/BOJ-V2
def daemon():
    def callback(ch, method, properties, body):
        print " [x] Received judge request %r" % (body,) # for debug
        s = Sub()
        try:
            s.getSub(body)
            c = Compile()
            c.compile(s)
        except Exception, e:
            print 'compile err| ', Exception, ':', e # for debug

        if s.status == jcnf.SUB_STATUS['judging']:
            try:
                j = Judge()
                j.judge(s)
            except Exception, e:
                print 'judge err| ', Exception, ':', e # for debug
示例#3
0
def main():
    trainIndex = 2
    rootPath = '../../exam_map/train' + str(trainIndex)
    carPath = os.path.join(rootPath, 'car.txt')
    roadPath = os.path.join(rootPath, 'road.txt')
    crossPath = os.path.join(rootPath, 'cross.txt')
    answerPath = os.path.join(rootPath, 'answer.txt')
    presetAnswerPath = os.path.join(rootPath, 'presetAnswer.txt')
    start = time.time()

    carsDict = read_car(carPath)
    roadsDict = read_road(roadPath)
    crossesDict = read_cross(crossPath, roadsDict)
    read_answer(carsDict, answerPath, presetAnswerPath)
    judge = Judge(carsDict, roadsDict, crossesDict)
    judge.init()
    judge.judge()

    print("total run time: ", time.time() - start)
    print("map {} done!".format(trainIndex))
示例#4
0
文件: test.py 项目: Mr-Phoebe/BOJ-V2
#!/usr/bin/env python
import time
from compile import Compile
from sub import Sub
from judge import Judge
c = Compile()
s = Sub()
s.sid = 1
s.lang = 'g++'
c.compile(s)
print 'ce:'+s.ce
print 'status:'+str(s.status)
s.pid = 15
s.case_cnt = 1
s.time_lim = 1000
s.mem_lim = 10240
s.case_lim = [{'time':1000, 'mem':4000},]
j = Judge()
j.judge(s)
print 'status:'+str(s.status)
print s.case_res

示例#5
0
文件: test.py 项目: YLAsce/oj
#!/usr/bin/env python
import time
from compile import Compile
from sub import Sub
from judge import Judge
c = Compile()
s = Sub()
s.sid = 1
s.lang = 'g++'
c.compile(s)
print 'ce:' + s.ce
print 'status:' + str(s.status)
s.pid = 15
s.case_cnt = 1
s.time_lim = 1000
s.mem_lim = 10240
s.case_lim = [
    {
        'time': 1000,
        'mem': 4000
    },
]
j = Judge()
j.judge(s)
print 'status:' + str(s.status)
print s.case_res