def end_judge_custom_error(self, label, info=""): F = open(self.config.result_path + "/result.txt", "w") F.write("error %s\n" % label) F.write("details\n") F.write("<error>%s</error>\n" % lib.htmlspecialchars(info)) F.close() exit(0)
def end_judge_compile_error(self, info=""): F = open(self.config.result_path + "/result.txt", "w") F.write("error Compile Error\n") F.write("details\n") F.write("<error>%s</error>\n" % lib.htmlspecialchars(info)) F.close() exit(0)
def end_judge_judgement_failed(self, info=""): F = open(self.config.result_path + "/result.txt", "w") F.write("error Judgment Failed\n") F.write("details\n") F.write("<error>%s</error>\n" % lib.htmlspecialchars(info)) F.close() exit(0)
def add_subtask_info(self, subTaskIndex, scr=0, info="", points=None): self.details_out += "<subtask " self.details_out += " num=\"%u\" " % subTaskIndex self.details_out += " score=\"%u\" " % scr self.details_out += " info=\"%s\" " % lib.htmlspecialchars(info) self.details_out += " >\n" if points: for each in points: self.add_point_info(each) self.details_out += " </subtask>\n"
def add_point_info(self, info): if info.ust >= 0: self.tot_time += info.ust if info.usm >= self.max_memory: self.max_memory = info.usm self.details_out += "<test num=\"%u\" score=\"%u\" info=\"%s\" time=\"%u\" memory=\"%u\">"\ % (info.num, info.scr / self.test_num, info.info, info.ust, info.usm) self.tot_score += info.scr / self.test_num if info.input: self.details_out += "<in>%s</in>" % (lib.htmlspecialchars( info.input)) if info.output: self.details_out += "<out>%s</out>" % (lib.htmlspecialchars( info.output)) if info.res: self.details_out += "<res>%s</res>" % (lib.htmlspecialchars( info.res)) if info.extrainfo: self.details_out += info.extrainfo self.details_out += "</test>\n"