fix(judger): wrong final score when subtask scores are not all configured

This commit is contained in:
Baoshuo Ren 2023-02-05 10:24:14 +08:00
parent a4371c2847
commit 1fc4b9afd2
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A

View File

@ -1681,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 {
@ -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);