mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 18:08:42 +00:00
fix: 当测试点 / Subtask 分数未完全配置时的最终得分 (#38)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
commit
933e55eaf6
@ -1637,13 +1637,33 @@ bool main_data_test(TP test_point_func) {
|
|||||||
|
|
||||||
bool passed = true;
|
bool passed = true;
|
||||||
if (nT == 0) { // OI
|
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++) {
|
for (int i = 1; i <= n; i++) {
|
||||||
report_judge_status_f("Judging Test #%d", i);
|
report_judge_status_f("Judging Test #%d", i);
|
||||||
PointInfo po = test_point_func(i);
|
PointInfo po = test_point_func(i);
|
||||||
if (po.scr != 100) {
|
if (po.scr != 100) {
|
||||||
passed = false;
|
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);
|
add_point_info(po);
|
||||||
}
|
}
|
||||||
} else if (nT == 1 && conf_subtask_meta_info(1).is_ordinary()) { // ACM
|
} 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
|
} 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;
|
map<int, SubtaskInfo> subtasks;
|
||||||
for (int t = 1; t <= nT; t++) {
|
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)) {
|
if (!st_info.resolve_dependencies(subtasks)) {
|
||||||
st_info.info = "Skipped";
|
st_info.info = "Skipped";
|
||||||
} else {
|
} else {
|
||||||
@ -1676,6 +1717,7 @@ bool main_data_test(TP test_point_func) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
subtasks[t] = st_info;
|
subtasks[t] = st_info;
|
||||||
passed = passed && st_info.passed;
|
passed = passed && st_info.passed;
|
||||||
add_subtask_info(st_info);
|
add_subtask_info(st_info);
|
||||||
|
@ -13,8 +13,17 @@ int main(int argc, char **argv) {
|
|||||||
rpc.limits = conf_run_limit("judger", 0, RL_JUDGER_DEFAULT);
|
rpc.limits = conf_run_limit("judger", 0, RL_JUDGER_DEFAULT);
|
||||||
rpc.unsafe = true;
|
rpc.unsafe = true;
|
||||||
runp::result res = runp::run(rpc);
|
runp::result res = runp::run(rpc);
|
||||||
|
|
||||||
if (res.type != runp::RS_AC) {
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user