workspace: use esnext set operations

This commit is contained in:
undefined committed 2026-04-05 23:12:48 +08:00
1 parent bf5533040e
commit 9c10219ecb
12 files changed
+28 -43

No files matched your search

+2 -2
View File
@@ -66,8 +66,8 @@ export async function judge({
if (stdAns instanceof Array) {
const stdSet = new Set(stdAns);
const ans = new Set(answers[key] instanceof Array ? answers[key] : [answers[key]]);
if (stdAns.length === ans.size && Set.isSuperset(stdSet, ans)) report(STATUS.STATUS_ACCEPTED, fullScore, 'Correct');
else if (ans.size && Set.isSuperset(stdSet, ans)) report(STATUS.STATUS_WRONG_ANSWER, Math.floor(fullScore / 2), 'Partially Correct');
if (stdAns.length === ans.size && stdSet.isSupersetOf(ans)) report(STATUS.STATUS_ACCEPTED, fullScore, 'Correct');
else if (ans.size && stdSet.isSupersetOf(ans)) report(STATUS.STATUS_WRONG_ANSWER, Math.floor(fullScore / 2), 'Partially Correct');
else report(STATUS.STATUS_WRONG_ANSWER, 0, 'Incorrect');
} else if (stdAns.toString() === usrAns) report(STATUS.STATUS_ACCEPTED, fullScore, 'Correct');
else report(STATUS.STATUS_WRONG_ANSWER, 0, 'Incorrect');