diff --git a/modules/contest.js b/modules/contest.js index e828188..369fc17 100644 --- a/modules/contest.js +++ b/modules/contest.js @@ -346,13 +346,15 @@ app.get('/contest/:id/:pid', async (req, res) => { await syzoj.utils.markdown(problem, [ 'description', 'input_format', 'output_format', 'example', 'limit_and_hint' ]); let state = await problem.getJudgeState(res.locals.user, false); + let testcases = await syzoj.utils.parseTestdata(problem.getTestdataPath(), problem.type === 'submit-answer'); res.render('problem', { pid: pid, contest: contest, problem: problem, state: state, - lastLanguage: res.locals.user ? await res.locals.user.getLastSubmitLanguage() : null + lastLanguage: res.locals.user ? await res.locals.user.getLastSubmitLanguage() : null, + testcases: testcases }); } catch (e) { syzoj.log(e); diff --git a/views/problem.ejs b/views/problem.ejs index f61b9fa..ff619db 100644 --- a/views/problem.ejs +++ b/views/problem.ejs @@ -1,3 +1,4 @@ +<% include util %> <% if (typeof contest === 'undefined') contest = null; if (contest) { @@ -29,34 +30,23 @@ if (contest) { <% } %> - <% if (contest) { %> -
- 内存限制:<%= problem.memory_limit %> MiB - 时间限制:<%= problem.time_limit %> ms -
-
- <% if (problem.file_io) { %> - 输入文件:<%= problem.file_io_input_name %> - 输出文件:<%= problem.file_io_output_name %> - <% } else { %> - 标准输入输出 - <% } %> -
- <% } else { %> -
- 内存限制:<%= problem.memory_limit %> MiB - 时间限制:<%= problem.time_limit %> ms - <% if (problem.file_io) { %> + <% if (problem.type !== 'submit-answer') { %> +
+ 内存限制:<%= problem.memory_limit %> MiB + 时间限制:<%= problem.time_limit %> ms + <% if (problem.file_io) { %> 输入文件: <%= problem.file_io_input_name %> 输出文件: <%= problem.file_io_output_name %> - <% } else { %> + <% } else { %> 标准输入输出 - <% } %> -
-
- 评测方式:<%= (testcases && !testcases.error) ? (testcases.spj ? 'Special Judge' : '文本比较') : '无测试数据' %> - 题目类型:<%= { 'submit-answer': '答案提交', 'interaction': '交互', 'traditional': '传统' }[problem.type] %> -
+ <% } %> +
+ <% } %> +
+ 题目类型:<%= { 'submit-answer': '答案提交', 'interaction': '交互', 'traditional': '传统' }[problem.type] %> + 评测方式:<%= (testcases && !testcases.error) ? (testcases.spj ? 'Special Judge' : '文本比较') : '无测试数据' %> +
+ <% if (!contest) { %>
上传者: <% if (problem.is_anonymous && !problem.allowedManage) { %>