Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修正当测试点 / Subtask 分数未完全配置时的最终得分 #109

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
45 changes: 43 additions & 2 deletions judger/uoj_judger/include/uoj_judger.h
Original file line number Diff line number Diff line change
Expand Up @@ -1634,13 +1634,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 / 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
Expand All @@ -1658,9 +1678,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));
SubtaskInfo st_info(subtask_metas[t]);

if (st_info.full_score == -1) {
st_info.full_score = remaining_subtasks_total_score / remaining_subtasks_cnt;
}

if (!st_info.resolve_dependencies(subtasks)) {
st_info.info = "Skipped";
} else {
Expand Down