+ 输入文件 +
<%= testcase.input %>
<%= testcase.answer %>
<%= testcase.user_out %>
<%= testcase.spj_message %>
- 输入文件 -
<%= testcase.input %>
<%= testcase.answer %>
<%= testcase.user_out %>
<%= testcase.spj_message %>
diff --git a/static/style.css b/static/style.css index 38d21c2..7c47612 100644 --- a/static/style.css +++ b/static/style.css @@ -39,7 +39,10 @@ pre { :not(.status_detail).status.accepted, .title:hover .status_detail.status.accepted, -.title.active .status_detail.status.accepted { +.title.active .status_detail.status.accepted, +:not(.status_detail).status.passed, +.title:hover .status_detail.status.passed, +.title.active .status_detail.status.passed { color: forestgreen; } diff --git a/utility.js b/utility.js index 19e2b1c..6c2b75d 100644 --- a/utility.js +++ b/utility.js @@ -146,18 +146,20 @@ module.exports = { let list = zip.getEntries().filter(e => !e.isDirectory).map(e => e.entryName); let res = []; if (!list.includes('data_rule.txt')) { + res[0] = {}; + res[0].cases = []; for (let file of list) { let parsedName = path.parse(file); if (parsedName.ext === '.in') { if (list.includes(`${parsedName.name}.out`)) { - res.push({ + res[0].cases.push({ input: file, output: `${parsedName.name}.out` }); } if (list.includes(`${parsedName.name}.ans`)) { - res.push({ + res[0].cases.push({ input: file, output: `${parsedName.name}.ans` }); @@ -165,7 +167,9 @@ module.exports = { } } - res.sort((a, b) => { + res[0].type = 'sum'; + res[0].score = 100; + res[0].cases.sort((a, b) => { function getLastInteger(s) { let re = /(\d+)\D*$/; let x = re.exec(s); @@ -176,24 +180,39 @@ module.exports = { return getLastInteger(a.input) - getLastInteger(b.input); }); } else { - let lines = zip.readAsText('data_rule.txt').split('\r').join('').split('\n'); + let lines = zip.readAsText('data_rule.txt').split('\r').join('').split('\n').filter(x => x.length !== 0); if (lines.length < 3) throw 'Invalid data_rule.txt'; - let numbers = lines[0].split(' ').filter(x => x); - let input = lines[1]; - let output = lines[2]; + let input = lines[lines.length - 2]; + let output = lines[lines.length - 1]; - for (let i of numbers) { - res[i] = {}; - res[i].input = input.replace('#', i); - res[i].output = output.replace('#', i); + for (let s = 0; s < lines.length - 2; ++s) { + res[s] = {}; + res[s].cases = []; + let numbers = lines[s].split(' ').filter(x => x); + if (numbers[0].includes(':')) { + let tokens = numbers[0].split(':'); + res[s].type = tokens[0] || 'sum'; + res[s].score = parseInt(tokens[1]); + numbers.shift(); + } else { + res[s].type = 'sum'; + res[s].score = 100; + } + for (let i of numbers) { + let testcase = { + input: input.replace('#', i), + output: output.replace('#', i) + }; - if (!list.includes(res[i].input)) throw `Can't find file ${res[i].input}`; - if (!list.includes(res[i].output)) throw `Can't find file ${res[i].output}`; + if (!list.includes(testcase.input)) throw `Can't find file ${testcase.input}`; + if (!list.includes(testcase.output)) throw `Can't find file ${testcase.output}`; + res[s].cases.push(testcase); + } } - res = res.filter(x => x); + res = res.filter(x => x.cases && x.cases.length !== 0); } res.spj = list.includes('spj.js'); diff --git a/views/judge_detail_item.ejs b/views/judge_detail_item.ejs index 0b6c414..a033a29 100644 --- a/views/judge_detail_item.ejs +++ b/views/judge_detail_item.ejs @@ -1,3 +1,26 @@ +<% +// Sanitize judge results for backward compatibility and clarity +if (!judge.result.subtasks) { + judge.result.subtasks = [ + { case_num: judge.result.case_num, status: judge.result.status, score: judge.result.score } + ]; + for (let i = 0; i < judge.result.case_num; ++i) { + judge.result.subtasks[0][i] = judge.result[i]; + } +} +let runningFound = false; +for (let s of judge.result.subtasks) { + s.pending = (s.status === 'Waiting' || s.status.startsWith('Running')); + for (let i = 0; i < s.case_num; ++i) if (!s[i]) { + s[i] = { + pending: true, + status: runningFound ? 'Waiting' : 'Running' + }; + runningFound = true; + } +} +%> +
<%= testcase.input %> | -<%= testcase.output %> | +→ 子任务评分方式:<%= subtask.type %>,分值:<%= subtask.score %> | |
<%= testcase.input %> | +<%= testcase.output %> | +