From eb39c9ec04efe97c8afd720ae2ab71121581bf20 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Sun, 5 Feb 2023 10:23:46 +0800 Subject: [PATCH 1/3] chore(judger): show more details when judger error --- judger/uoj_judger/main_judger.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/judger/uoj_judger/main_judger.cpp b/judger/uoj_judger/main_judger.cpp index 06607df..0530a3a 100644 --- a/judger/uoj_judger/main_judger.cpp +++ b/judger/uoj_judger/main_judger.cpp @@ -13,8 +13,17 @@ int main(int argc, char **argv) { rpc.limits = conf_run_limit("judger", 0, RL_JUDGER_DEFAULT); rpc.unsafe = true; runp::result res = runp::run(rpc); + if (res.type != runp::RS_AC) { - end_judge_judgment_failed("Judgment Failed : Judger " + runp::rstype_str(res.type)); + stringstream msg; + + msg << "Judgment Failed" << endl; + msg << "\n------\n" << endl; + msg << "Judger result: " << runp::rstype_str(res.type) << endl; + msg << "Extra message: " << res.extra << endl; + + end_judge_judgment_failed(msg.str()); } + return 0; } From a4371c2847cbdea28d474fc3b83a308379afcae2 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Sun, 5 Feb 2023 10:24:03 +0800 Subject: [PATCH 2/3] fix(judger): wrong final score when test point scores are not all configured --- judger/uoj_judger/include/uoj_judger.h | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/judger/uoj_judger/include/uoj_judger.h b/judger/uoj_judger/include/uoj_judger.h index 842375e..600e806 100644 --- a/judger/uoj_judger/include/uoj_judger.h +++ b/judger/uoj_judger/include/uoj_judger.h @@ -1637,13 +1637,33 @@ bool main_data_test(TP test_point_func) { bool passed = true; if (nT == 0) { // OI + map point_scores; + score_t remaining_tests_total_score = 100; + int remaining_tests_cnt = n; + + for (int i = 1; i <= n; i++) { + score_t point_score = conf_score("point_score", i, -1); + + if (point_score != -1) { + point_scores[i] = point_score; + remaining_tests_total_score -= point_score; + remaining_tests_cnt--; + } + } + for (int i = 1; i <= n; i++) { report_judge_status_f("Judging Test #%d", i); PointInfo po = test_point_func(i); if (po.scr != 100) { passed = false; } - po.scr = scale_score(po.scr, conf_score("point_score", i, 100.0 / n)); + + if (point_scores.count(i)) { + po.scr = scale_score(po.scr, point_scores[i]); + } else { + po.scr = scale_score(po.scr, remaining_tests_total_score / remaining_tests_cnt); + } + add_point_info(po); } } else if (nT == 1 && conf_subtask_meta_info(1).is_ordinary()) { // ACM From 1fc4b9afd2710803145b6618c2943842588f1074 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Sun, 5 Feb 2023 10:24:14 +0800 Subject: [PATCH 3/3] fix(judger): wrong final score when subtask scores are not all configured --- judger/uoj_judger/include/uoj_judger.h | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/judger/uoj_judger/include/uoj_judger.h b/judger/uoj_judger/include/uoj_judger.h index 600e806..2f8bcb9 100644 --- a/judger/uoj_judger/include/uoj_judger.h +++ b/judger/uoj_judger/include/uoj_judger.h @@ -1681,9 +1681,30 @@ bool main_data_test(TP test_point_func) { } } } else { // subtask + map subtask_metas; + score_t remaining_subtasks_total_score = 100; + int remaining_subtasks_cnt = nT; + + for (int t = 1; t <= nT; t++) { + score_t subtask_score = conf_score("subtask_score", t, -1); + + subtask_metas[t] = conf_subtask_meta_info(t); + subtask_metas[t].full_score = subtask_score; + + if (subtask_score != -1) { + remaining_subtasks_total_score -= subtask_score; + remaining_subtasks_cnt--; + } + } + map subtasks; for (int t = 1; t <= nT; t++) { - SubtaskInfo st_info(conf_subtask_meta_info(t)); + if (subtask_metas[t].full_score == -1) { + subtask_metas[t].full_score = remaining_subtasks_total_score / remaining_subtasks_cnt; + } + + SubtaskInfo st_info(subtask_metas[t]); + if (!st_info.resolve_dependencies(subtasks)) { st_info.info = "Skipped"; } else { @@ -1696,6 +1717,7 @@ bool main_data_test(TP test_point_func) { } } } + subtasks[t] = st_info; passed = passed && st_info.passed; add_subtask_info(st_info);