From 5a9f66538bb413235a9186dac999081c76523b98 Mon Sep 17 00:00:00 2001 From: handsomehow <673712786@qq.com> Date: Sat, 17 Nov 2018 11:24:59 +0800 Subject: [PATCH 1/3] update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 112ebb1..a496a7b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ RUN buildDeps='software-properties-common git libtool cmake python-dev python3-p apt-get update && apt-get install -y python python3.5 python-pkg-resources python3-pkg-resources gcc g++ $buildDeps && \ add-apt-repository ppa:openjdk-r/ppa && apt-get update && apt-get install -y openjdk-8-jdk && \ pip3 install --no-cache-dir psutil gunicorn flask requests && \ - cd /tmp && git clone -b newnew --depth 1 https://github.com/QingdaoU/Judger && cd Judger && \ + cd /tmp && git clone -b newnew --depth 1 https://github.com/HandsomeHow/Judger && cd Judger && \ mkdir build && cd build && cmake .. && make && make install && cd ../bindings/Python && python3 setup.py install && \ apt-get purge -y --auto-remove $buildDeps && \ apt-get clean && rm -rf /var/lib/apt/lists/* && \ From b64228bad67a0f3d631baca06d9b75b7f49e67c4 Mon Sep 17 00:00:00 2001 From: HandsomeHow <673712786@qq.com> Date: Thu, 27 Dec 2018 23:40:43 +0800 Subject: [PATCH 2/3] pe support --- server/judge_client.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/server/judge_client.py b/server/judge_client.py index b1de457..089eef6 100644 --- a/server/judge_client.py +++ b/server/judge_client.py @@ -59,8 +59,10 @@ def _compare_output(self, test_case_file_id): with open(user_output_file, "rb") as f: content = f.read() output_md5 = hashlib.md5(content.rstrip()).hexdigest() - result = output_md5 == self._get_test_case_file_info(test_case_file_id)["stripped_output_md5"] - return output_md5, result + all_stripped_md5 = hashlib.md5(b'\n'.join([x.rstrip() for x in content.split(b'\n') if len(x) > 0])).hexdigest() + is_ac = output_md5 == self._get_test_case_file_info(test_case_file_id)["stripped_output_md5"] + is_pe = all_stripped_md5 == self._get_test_case_file_info(test_case_file_id)["all_stripped_output_md5"] + return output_md5, is_ac, is_pe def _spj(self, in_file_path, user_out_file_path): os.chown(self._submission_dir, SPJ_USER_UID, 0) @@ -138,10 +140,12 @@ def _judge_one(self, test_case_file_id): run_result["result"] = _judger.RESULT_SYSTEM_ERROR run_result["error"] = _judger.ERROR_SPJ_ERROR else: - run_result["output_md5"], is_ac = self._compare_output(test_case_file_id) + run_result["output_md5"], is_ac, is_pe = self._compare_output(test_case_file_id) # -1 == Wrong Answer if not is_ac: run_result["result"] = _judger.RESULT_WRONG_ANSWER + if not is_ac and is_pe: + run_result["result"] = _judger.RESULT_PRESENTATION_ERROR if self._output: try: From 95bb3c0b908a3e3f675351b095f55a4f480809d1 Mon Sep 17 00:00:00 2001 From: HandsomeHow <673712786@qq.com> Date: Fri, 28 Dec 2018 11:49:48 +0800 Subject: [PATCH 3/3] revert Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a496a7b..112ebb1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ RUN buildDeps='software-properties-common git libtool cmake python-dev python3-p apt-get update && apt-get install -y python python3.5 python-pkg-resources python3-pkg-resources gcc g++ $buildDeps && \ add-apt-repository ppa:openjdk-r/ppa && apt-get update && apt-get install -y openjdk-8-jdk && \ pip3 install --no-cache-dir psutil gunicorn flask requests && \ - cd /tmp && git clone -b newnew --depth 1 https://github.com/HandsomeHow/Judger && cd Judger && \ + cd /tmp && git clone -b newnew --depth 1 https://github.com/QingdaoU/Judger && cd Judger && \ mkdir build && cd build && cmake .. && make && make install && cd ../bindings/Python && python3 setup.py install && \ apt-get purge -y --auto-remove $buildDeps && \ apt-get clean && rm -rf /var/lib/apt/lists/* && \