fix: 当测试点 / Subtask 分数未完全配置时的最终得分 (#38)
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Baoshuo Ren 2023-02-05 19:20:14 +08:00 committed by GitHub
commit 933e55eaf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 54 additions and 3 deletions

View File

@ -1637,13 +1637,33 @@ bool main_data_test(TP test_point_func) {
bool passed = true;
if (nT == 0) { // OI
map<int, score_t> 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
@ -1661,9 +1681,30 @@ bool main_data_test(TP test_point_func) {
}
}
} else { // subtask
map<int, SubtaskMetaInfo> 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<int, SubtaskInfo> 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 {
@ -1676,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);

View File

@ -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;
}