2016-07-18 16:39:37 +00:00
|
|
|
|
<?php
|
2022-11-06 02:26:21 +00:00
|
|
|
|
requireLib('hljs');
|
|
|
|
|
requireLib('mathjax');
|
|
|
|
|
requirePHPLib('form');
|
|
|
|
|
requirePHPLib('judger');
|
|
|
|
|
|
|
|
|
|
Auth::check() || redirectToLogin();
|
|
|
|
|
UOJProblem::init(UOJRequest::get('id')) || UOJResponse::page404();
|
|
|
|
|
|
|
|
|
|
$problem = UOJProblem::cur()->info;
|
|
|
|
|
$problem_content = UOJProblem::cur()->queryContent();
|
|
|
|
|
|
|
|
|
|
if (UOJRequest::get('contest_id')) {
|
|
|
|
|
UOJContest::init(UOJRequest::get('contest_id')) || UOJResponse::page404();
|
|
|
|
|
UOJProblem::upgradeToContestProblem() || UOJResponse::page404();
|
|
|
|
|
}
|
|
|
|
|
UOJProblem::cur()->userCanView(Auth::user(), ['ensure' => true]);
|
|
|
|
|
|
|
|
|
|
$pre_submit_check_ret = UOJProblem::cur()->preSubmitCheck();
|
|
|
|
|
|
|
|
|
|
$is_participating = false;
|
|
|
|
|
$no_more_submission = false;
|
|
|
|
|
$submission_warning = null;
|
|
|
|
|
if (UOJContest::cur()) {
|
|
|
|
|
if (UOJContest::cur()->userCanParticipateNow(Auth::user())) {
|
|
|
|
|
if (!UOJContest::cur()->userHasMarkedParticipated(Auth::user())) {
|
|
|
|
|
redirectTo(UOJContest::cur()->getUri("/confirm"));
|
2016-07-18 16:39:37 +00:00
|
|
|
|
}
|
2022-11-06 02:26:21 +00:00
|
|
|
|
$is_participating = true;
|
|
|
|
|
$submit_time_limit = UOJContestProblem::cur()->submitTimeLimit();
|
|
|
|
|
$max_cnt = UOJContest::cur()->maxSubmissionCountPerProblem();
|
|
|
|
|
if ($submit_time_limit != -1) {
|
|
|
|
|
$cur_contest_time = (UOJTime::$time_now->getTimestamp() - UOJContest::info('start_time')->getTimestamp()) / 60;
|
|
|
|
|
if ($cur_contest_time > $submit_time_limit) {
|
|
|
|
|
$no_more_submission = "本题只能在比赛的前 {$submit_time_limit} 分钟提交,没法再交咯";
|
2016-07-18 16:39:37 +00:00
|
|
|
|
}
|
2022-11-06 02:26:21 +00:00
|
|
|
|
}
|
|
|
|
|
if (!$no_more_submission) {
|
|
|
|
|
if ($max_cnt != -1) {
|
|
|
|
|
$cnt = UOJContestProblem::cur()->queryUserSubmissionCountInContest(Auth::user());
|
|
|
|
|
if ($cnt >= $max_cnt) {
|
|
|
|
|
$no_more_submission = "提交次数已达到 {$cnt} 次,没法再交咯";
|
2022-10-23 12:39:11 +00:00
|
|
|
|
}
|
2022-04-04 11:35:20 +00:00
|
|
|
|
}
|
2016-07-18 16:39:37 +00:00
|
|
|
|
}
|
2022-11-06 02:26:21 +00:00
|
|
|
|
if (!$no_more_submission) {
|
|
|
|
|
if ($max_cnt != -1) {
|
|
|
|
|
$warning1 = "已使用 {$cnt}/{$max_cnt} 次提交机会";
|
|
|
|
|
} else {
|
|
|
|
|
$warning1 = null;
|
|
|
|
|
}
|
|
|
|
|
if ($submit_time_limit != -1) {
|
|
|
|
|
$warning2 = "注意本题只能在比赛的前 {$submit_time_limit} 分钟提交";
|
|
|
|
|
} else {
|
|
|
|
|
$warning2 = null;
|
|
|
|
|
}
|
|
|
|
|
if ($warning1 && $warning2) {
|
|
|
|
|
$submission_warning = "{$warning1}({$warning2})";
|
|
|
|
|
} else {
|
|
|
|
|
$submission_warning = $warning1 !== null ? $warning1 : $warning2;
|
|
|
|
|
}
|
2022-04-03 10:18:17 +00:00
|
|
|
|
}
|
2016-07-18 16:39:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 02:26:21 +00:00
|
|
|
|
// 比赛导航
|
|
|
|
|
$tabs_info = [
|
|
|
|
|
'dashboard' => [
|
|
|
|
|
'name' => UOJLocale::get('contests::contest dashboard'),
|
2023-02-12 11:23:23 +00:00
|
|
|
|
'url' => UOJContest::cur()->getUri(),
|
2022-11-06 02:26:21 +00:00
|
|
|
|
],
|
|
|
|
|
'submissions' => [
|
|
|
|
|
'name' => UOJLocale::get('contests::contest submissions'),
|
2023-02-12 11:23:23 +00:00
|
|
|
|
'url' => UOJContest::cur()->getUri('/submissions'),
|
2022-11-06 02:26:21 +00:00
|
|
|
|
],
|
|
|
|
|
'standings' => [
|
|
|
|
|
'name' => UOJLocale::get('contests::contest standings'),
|
2023-02-12 11:23:23 +00:00
|
|
|
|
'url' => UOJContest::cur()->getUri('/standings'),
|
2022-11-06 02:26:21 +00:00
|
|
|
|
],
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
if (UOJContest::cur()->progress() > CONTEST_TESTING) {
|
|
|
|
|
$tabs_info['after_contest_standings'] = [
|
|
|
|
|
'name' => UOJLocale::get('contests::after contest standings'),
|
2023-02-12 11:23:23 +00:00
|
|
|
|
'url' => UOJContest::cur()->getUri('/after_contest_standings'),
|
2022-11-06 02:26:21 +00:00
|
|
|
|
];
|
|
|
|
|
$tabs_info['self_reviews'] = [
|
|
|
|
|
'name' => UOJLocale::get('contests::contest self reviews'),
|
2023-02-12 11:23:23 +00:00
|
|
|
|
'url' => UOJContest::cur()->getUri('/self_reviews'),
|
2022-11-06 02:26:21 +00:00
|
|
|
|
];
|
|
|
|
|
}
|
2016-07-18 16:39:37 +00:00
|
|
|
|
|
2022-11-06 02:26:21 +00:00
|
|
|
|
if (UOJContest::cur()->userCanManage(Auth::user())) {
|
|
|
|
|
$tabs_info['backstage'] = [
|
|
|
|
|
'name' => UOJLocale::get('contests::contest backstage'),
|
2023-02-12 11:23:23 +00:00
|
|
|
|
'url' => UOJContest::cur()->getUri('/backstage'),
|
2022-11-06 02:26:21 +00:00
|
|
|
|
];
|
2016-07-18 16:39:37 +00:00
|
|
|
|
}
|
2022-11-06 02:26:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$submission_requirement = UOJProblem::cur()->getSubmissionRequirement();
|
|
|
|
|
$custom_test_requirement = UOJProblem::cur()->getCustomTestRequirement();
|
2023-02-01 12:27:05 +00:00
|
|
|
|
$custom_test_enabled = $custom_test_requirement && $pre_submit_check_ret === true && UOJProblem::info('type') != 'remote';
|
2022-11-06 02:26:21 +00:00
|
|
|
|
|
|
|
|
|
function handleUpload($zip_file_name, $content, $tot_size) {
|
|
|
|
|
global $is_participating;
|
2023-02-03 01:06:47 +00:00
|
|
|
|
|
|
|
|
|
$remote_oj = UOJProblem::cur()->getExtraConfig('remote_online_judge');
|
|
|
|
|
$remote_provider = UOJRemoteProblem::$providers[$remote_oj];
|
|
|
|
|
|
|
|
|
|
if (UOJProblem::info('type') == 'remote') {
|
|
|
|
|
$submit_type = in_array($_POST['answer_remote_submit_type'], $remote_provider['submit_type']) ? $_POST['answer_remote_submit_type'] : $remote_provider['submit_type'][0];
|
2023-03-28 13:05:39 +00:00
|
|
|
|
$content['remote_judge'] = true;
|
2023-02-06 01:30:21 +00:00
|
|
|
|
$content['config'][] = ['remote_submit_type', $submit_type];
|
2023-02-05 13:57:33 +00:00
|
|
|
|
|
2023-02-03 02:47:58 +00:00
|
|
|
|
if ($submit_type != 'bot') {
|
|
|
|
|
$content['no_rejudge'] = true;
|
2023-02-05 13:57:33 +00:00
|
|
|
|
$content['config'][] = ['remote_account_data', $_POST['answer_remote_account_data']];
|
2023-02-03 02:47:58 +00:00
|
|
|
|
}
|
2023-02-05 13:57:33 +00:00
|
|
|
|
|
2023-02-06 01:30:21 +00:00
|
|
|
|
if ($submit_type == 'archive') {
|
|
|
|
|
$content['remote_submission_id'] = $_POST['answer_remote_submission_id'];
|
|
|
|
|
$content['config'][] = ['remote_submission_id', $_POST['answer_remote_submission_id']];
|
|
|
|
|
|
2023-02-06 03:43:18 +00:00
|
|
|
|
$content['config'] = array_values(array_filter(
|
2023-02-06 01:30:21 +00:00
|
|
|
|
$content['config'],
|
2023-02-06 03:43:18 +00:00
|
|
|
|
function ($row) {
|
|
|
|
|
return !strEndWith($row[0], '_language');
|
2023-02-06 01:30:21 +00:00
|
|
|
|
},
|
2023-02-06 03:43:18 +00:00
|
|
|
|
));
|
2023-02-06 01:30:21 +00:00
|
|
|
|
|
|
|
|
|
$zip_file = new ZipArchive();
|
2023-02-06 03:43:18 +00:00
|
|
|
|
$zip_file->open(UOJContext::storagePath() . $zip_file_name, ZipArchive::OVERWRITE);
|
2023-02-06 01:30:21 +00:00
|
|
|
|
$zip_file->addFromString('answer.code', '');
|
|
|
|
|
$zip_file->close();
|
2023-02-07 13:20:42 +00:00
|
|
|
|
|
|
|
|
|
$tot_size = 0;
|
2023-02-06 01:30:21 +00:00
|
|
|
|
}
|
2023-02-03 01:06:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-02-18 01:19:21 +00:00
|
|
|
|
$id = UOJSubmission::onUpload($zip_file_name, $content, $tot_size, $is_participating);
|
|
|
|
|
|
|
|
|
|
if ($is_participating) {
|
|
|
|
|
// redirect by UOJForm
|
|
|
|
|
} else {
|
|
|
|
|
redirectTo("/submission/$id");
|
|
|
|
|
}
|
2022-11-06 02:26:21 +00:00
|
|
|
|
}
|
|
|
|
|
function handleCustomTestUpload($zip_file_name, $content, $tot_size) {
|
|
|
|
|
UOJCustomTestSubmission::onUpload($zip_file_name, $content, $tot_size);
|
|
|
|
|
}
|
|
|
|
|
if ($custom_test_enabled) {
|
|
|
|
|
UOJCustomTestSubmission::init(UOJProblem::cur(), Auth::user());
|
|
|
|
|
|
|
|
|
|
if (UOJRequest::get('get') == 'custom-test-status-details') {
|
|
|
|
|
if (!UOJCustomTestSubmission::cur()) {
|
2016-07-18 16:39:37 +00:00
|
|
|
|
echo json_encode(null);
|
2022-11-06 02:26:21 +00:00
|
|
|
|
} elseif (!UOJCustomTestSubmission::cur()->hasJudged()) {
|
|
|
|
|
echo json_encode([
|
2016-07-18 16:39:37 +00:00
|
|
|
|
'judged' => false,
|
2022-11-06 02:26:21 +00:00
|
|
|
|
'waiting' => true,
|
|
|
|
|
'html' => UOJCustomTestSubmission::cur()->getStatusDetailsHTML(),
|
|
|
|
|
]);
|
2016-07-18 16:39:37 +00:00
|
|
|
|
} else {
|
|
|
|
|
ob_start();
|
|
|
|
|
$styler = new CustomTestSubmissionDetailsStyler();
|
2022-11-06 02:26:21 +00:00
|
|
|
|
if (!UOJCustomTestSubmission::cur()->userPermissionCodeCheck(Auth::user(), UOJProblem::cur()->getExtraConfig('view_details_type'))) {
|
2016-07-18 16:39:37 +00:00
|
|
|
|
$styler->fade_all_details = true;
|
|
|
|
|
}
|
2022-11-06 02:26:21 +00:00
|
|
|
|
echoJudgmentDetails(UOJCustomTestSubmission::cur()->getResult('details'), $styler, 'custom_test_details');
|
2016-07-18 16:39:37 +00:00
|
|
|
|
$result = ob_get_contents();
|
|
|
|
|
ob_end_clean();
|
2022-11-06 02:26:21 +00:00
|
|
|
|
echo json_encode([
|
2016-07-18 16:39:37 +00:00
|
|
|
|
'judged' => true,
|
2022-11-06 02:26:21 +00:00
|
|
|
|
'waiting' => false,
|
|
|
|
|
'html' => UOJCustomTestSubmission::cur()->getStatusDetailsHTML(),
|
2016-07-18 16:39:37 +00:00
|
|
|
|
'result' => $result
|
2022-11-06 02:26:21 +00:00
|
|
|
|
]);
|
2016-07-18 16:39:37 +00:00
|
|
|
|
}
|
|
|
|
|
die();
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 02:26:21 +00:00
|
|
|
|
$custom_test_form = newSubmissionForm(
|
|
|
|
|
'custom_test',
|
|
|
|
|
$custom_test_requirement,
|
|
|
|
|
'FS::randomAvailableTmpFileName',
|
|
|
|
|
'handleCustomTestUpload'
|
|
|
|
|
);
|
|
|
|
|
$custom_test_form->appendHTML('<div id="div-custom_test_result"></div>');
|
|
|
|
|
$custom_test_form->succ_href = 'none';
|
|
|
|
|
$custom_test_form->extra_validator = function () {
|
|
|
|
|
if (UOJCustomTestSubmission::cur() && !UOJCustomTestSubmission::cur()->hasJudged()) {
|
|
|
|
|
return '上一个测评尚未结束';
|
2016-07-18 16:39:37 +00:00
|
|
|
|
}
|
2022-11-06 02:26:21 +00:00
|
|
|
|
return '';
|
|
|
|
|
};
|
2023-02-01 10:11:26 +00:00
|
|
|
|
$custom_test_form->setAjaxSubmit(<<<EOD
|
2022-11-06 02:26:21 +00:00
|
|
|
|
function(response_text) {
|
|
|
|
|
custom_test_onsubmit(
|
|
|
|
|
response_text,
|
|
|
|
|
$('#div-custom_test_result')[0],
|
|
|
|
|
'{$_SERVER['REQUEST_URI']}?get=custom-test-status-details'
|
|
|
|
|
)
|
2016-07-18 16:39:37 +00:00
|
|
|
|
}
|
2023-02-01 10:11:26 +00:00
|
|
|
|
EOD);
|
|
|
|
|
$custom_test_form->config['submit_button']['text'] = UOJLocale::get('problems::run');
|
2022-11-06 02:26:21 +00:00
|
|
|
|
$custom_test_form->runAtServer();
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-01 12:27:05 +00:00
|
|
|
|
if (empty($submission_requirement)) {
|
2023-02-12 11:23:23 +00:00
|
|
|
|
$no_more_submission = UOJLocale::get('problems::cannot submit');
|
2022-11-06 02:26:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($pre_submit_check_ret === true && !$no_more_submission) {
|
|
|
|
|
$submission_extra_validator = function () {
|
|
|
|
|
if (!submission_frequency_check()) {
|
|
|
|
|
UOJLog::warning('a user exceeds the submission frequency limit! ' . Auth::id() . ' at problem #' . UOJProblem::info('id'));
|
|
|
|
|
return '交题交得太快啦,坐下来喝杯阿华田休息下吧?';
|
2016-07-18 16:39:37 +00:00
|
|
|
|
}
|
|
|
|
|
return '';
|
|
|
|
|
};
|
|
|
|
|
|
2022-11-06 02:26:21 +00:00
|
|
|
|
if (UOJProblem::cur()->userCanUploadSubmissionViaZip(Auth::user())) {
|
|
|
|
|
$zip_answer_form = newZipSubmissionForm(
|
2023-02-03 01:06:47 +00:00
|
|
|
|
'zip_answer',
|
2022-11-06 02:26:21 +00:00
|
|
|
|
$submission_requirement,
|
|
|
|
|
'FS::randomAvailableSubmissionFileName',
|
|
|
|
|
'handleUpload'
|
2016-07-18 16:39:37 +00:00
|
|
|
|
);
|
2023-02-02 10:45:26 +00:00
|
|
|
|
$zip_answer_form->extra_validators[] = $submission_extra_validator;
|
2023-02-12 11:23:23 +00:00
|
|
|
|
$zip_answer_form->succ_href = $is_participating ? UOJContest::cur()->getUri('/submissions') : '/submissions';
|
2022-11-06 02:26:21 +00:00
|
|
|
|
$zip_answer_form->runAtServer();
|
2016-07-18 16:39:37 +00:00
|
|
|
|
}
|
2022-10-07 01:31:31 +00:00
|
|
|
|
|
2022-11-06 02:26:21 +00:00
|
|
|
|
$answer_form = newSubmissionForm(
|
|
|
|
|
'answer',
|
|
|
|
|
$submission_requirement,
|
|
|
|
|
'FS::randomAvailableSubmissionFileName',
|
|
|
|
|
'handleUpload'
|
2022-10-07 01:31:31 +00:00
|
|
|
|
);
|
2023-02-03 01:06:47 +00:00
|
|
|
|
|
|
|
|
|
if (UOJProblem::info('type') == 'remote') {
|
|
|
|
|
$remote_oj = UOJProblem::cur()->getExtraConfig('remote_online_judge');
|
|
|
|
|
$remote_pid = UOJProblem::cur()->getExtraConfig('remote_problem_id');
|
|
|
|
|
$remote_url = UOJRemoteProblem::getProblemRemoteUrl($remote_oj, $remote_pid);
|
2023-02-06 01:30:21 +00:00
|
|
|
|
$remote_provider = UOJRemoteProblem::$providers[$remote_oj];
|
|
|
|
|
$submit_type = json_encode($remote_provider['submit_type']);
|
|
|
|
|
|
|
|
|
|
$answer_form->add('answer_remote_submit_type', '', function ($opt) use ($remote_provider) {
|
|
|
|
|
return in_array($opt, $remote_provider['submit_type']) ? '' : '无效选项';
|
|
|
|
|
}, null);
|
|
|
|
|
$answer_form->add('answer_remote_account_data', '', function ($data) {
|
2023-02-06 02:15:15 +00:00
|
|
|
|
return $_POST['answer_remote_submit_type'] == 'bot' || json_decode($data) !== null ? '' : '无效数据';
|
2023-02-06 01:30:21 +00:00
|
|
|
|
}, null);
|
|
|
|
|
$answer_form->add('answer_remote_submission_id', '', function ($id) {
|
2023-02-06 02:15:15 +00:00
|
|
|
|
return $_POST['answer_remote_submit_type'] != 'archive' || validateUInt($id) ? '' : '无效 ID';
|
2023-02-06 01:30:21 +00:00
|
|
|
|
}, null);
|
2023-02-03 01:06:47 +00:00
|
|
|
|
$answer_form->appendHTML(<<<EOD
|
|
|
|
|
<h5>Remote Judge 配置</h5>
|
|
|
|
|
<div class="" id="answer-remote_submit_group"></div>
|
|
|
|
|
<script>
|
|
|
|
|
$('#answer-remote_submit_group').remote_submit_type_group("{$remote_oj}", "{$remote_pid}", "{$remote_url}", {$submit_type});
|
|
|
|
|
</script>
|
|
|
|
|
EOD);
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 02:26:21 +00:00
|
|
|
|
$answer_form->extra_validator = $submission_extra_validator;
|
2023-02-12 11:23:23 +00:00
|
|
|
|
$answer_form->succ_href = $is_participating ? UOJContest::cur()->getUri('/submissions') : '/submissions';
|
2022-11-06 02:26:21 +00:00
|
|
|
|
$answer_form->runAtServer();
|
|
|
|
|
}
|
2022-10-07 01:31:31 +00:00
|
|
|
|
|
2022-11-06 02:26:21 +00:00
|
|
|
|
$conf = UOJProblem::cur()->getProblemConf();
|
2022-11-07 07:44:01 +00:00
|
|
|
|
|
|
|
|
|
if (UOJContest::cur()) {
|
|
|
|
|
$pageTitle = UOJProblem::cur()->getTitle(['with' => 'letter', 'simplify' => true]);
|
|
|
|
|
} else {
|
|
|
|
|
$pageTitle = UOJProblem::cur()->getTitle(['with' => 'id']);
|
|
|
|
|
}
|
2022-11-06 02:26:21 +00:00
|
|
|
|
?>
|
2022-09-25 10:28:43 +00:00
|
|
|
|
|
2022-11-07 07:44:01 +00:00
|
|
|
|
<?php echoUOJPageHeader(HTML::stripTags($pageTitle) . ' - ' . UOJLocale::get('problems::problem')) ?>
|
2022-09-25 10:28:43 +00:00
|
|
|
|
|
2022-11-06 02:26:21 +00:00
|
|
|
|
<div class="row">
|
|
|
|
|
<!-- Left col -->
|
|
|
|
|
<div class="col-lg-9">
|
|
|
|
|
<?php if (isset($tabs_info)) : ?>
|
|
|
|
|
<!-- 比赛导航 -->
|
|
|
|
|
<div class="mb-2">
|
|
|
|
|
<?= HTML::tablist($tabs_info, '', 'nav-pills') ?>
|
|
|
|
|
</div>
|
2016-07-18 16:39:37 +00:00
|
|
|
|
<?php endif ?>
|
2022-09-25 10:28:43 +00:00
|
|
|
|
|
2022-11-06 02:26:21 +00:00
|
|
|
|
<div class="card card-default mb-2">
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<h1 class="card-title text-center">
|
|
|
|
|
<?php if (UOJContest::cur()) : ?>
|
|
|
|
|
<?= UOJProblem::cur()->getTitle(['with' => 'letter', 'simplify' => true]) ?>
|
|
|
|
|
<?php else : ?>
|
|
|
|
|
<?= UOJProblem::cur()->getTitle(['with' => 'id']) ?>
|
|
|
|
|
<?php endif ?>
|
|
|
|
|
</h1>
|
|
|
|
|
|
|
|
|
|
<?php
|
2023-01-19 08:06:42 +00:00
|
|
|
|
if (UOJProblem::info('type') == 'local') {
|
2023-01-18 08:20:12 +00:00
|
|
|
|
$time_limit = $conf instanceof UOJProblemConf ? $conf->getVal('time_limit', 1) : null;
|
|
|
|
|
$memory_limit = $conf instanceof UOJProblemConf ? $conf->getVal('memory_limit', 256) : null;
|
2023-02-26 09:09:27 +00:00
|
|
|
|
$judge_type = $conf instanceof UOJProblemConf ? $conf->getNonTraditionalJudgeType() : null;
|
2023-01-19 08:06:42 +00:00
|
|
|
|
} else if (UOJProblem::info('type') == 'remote') {
|
2023-01-18 08:20:12 +00:00
|
|
|
|
$time_limit = UOJProblem::cur()->getExtraConfig('time_limit');
|
|
|
|
|
$memory_limit = UOJProblem::cur()->getExtraConfig('memory_limit');
|
2023-02-26 09:09:27 +00:00
|
|
|
|
$judge_type = 'remote_judge';
|
2023-01-18 08:20:12 +00:00
|
|
|
|
}
|
2022-11-06 02:26:21 +00:00
|
|
|
|
?>
|
|
|
|
|
<div class="text-center small">
|
2023-02-12 11:23:23 +00:00
|
|
|
|
<?= UOJLocale::get('problems::time limit') ?>: <?= $time_limit ? "$time_limit s" : "N/A" ?>
|
2022-11-06 02:26:21 +00:00
|
|
|
|
 
|
2023-02-12 11:23:23 +00:00
|
|
|
|
<?= UOJLocale::get('problems::memory limit') ?>: <?= $memory_limit ? "$memory_limit MB" : "N/A" ?>
|
2023-02-26 09:09:27 +00:00
|
|
|
|
 
|
|
|
|
|
<?= UOJLocale::get('problems::judge type') ?>: <?= $judge_type ? (UOJLocale::get("problems::judge type $judge_type") ?: $judge_type) : "N/A" ?>
|
2022-11-06 02:26:21 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
2023-02-16 03:03:32 +00:00
|
|
|
|
<hr />
|
|
|
|
|
|
2022-11-06 02:26:21 +00:00
|
|
|
|
<div class="tab-content">
|
|
|
|
|
<div class="tab-pane active" id="statement">
|
2023-02-26 09:09:27 +00:00
|
|
|
|
<?php if (!UOJContest::cur()) : ?>
|
|
|
|
|
<?php $contest_problems = UOJProblem::cur()->findInContests(); ?>
|
|
|
|
|
<?php if (!empty($contest_problems)) : ?>
|
|
|
|
|
<div class="alert alert-light">
|
|
|
|
|
<h5 class="alert-heading"><?= UOJLocale::get('problems::the problem was used in the following contest') ?>:</h5>
|
|
|
|
|
<ul class="mb-0">
|
|
|
|
|
<?php usort($contest_problems, fn ($a, $b) => $a->contest->info['start_time'] < $b->contest->info['start_time']); ?>
|
|
|
|
|
<?php foreach ($contest_problems as $cp) : ?>
|
|
|
|
|
<?php if ($cp->userCanView(Auth::user())) : ?>
|
|
|
|
|
<li>
|
|
|
|
|
<?= $cp->contest->getLink(['class' => 'alert-link text-decoration-underline']) ?>
|
|
|
|
|
<small>(<?= $cp->contest->info['start_time_str'] ?>)</small>
|
|
|
|
|
</li>
|
|
|
|
|
<?php endif ?>
|
|
|
|
|
<?php endforeach ?>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<hr />
|
|
|
|
|
<?php endif ?>
|
|
|
|
|
<?php endif ?>
|
|
|
|
|
|
2022-11-06 02:26:21 +00:00
|
|
|
|
<article class="mt-3 markdown-body">
|
|
|
|
|
<?= $problem_content['statement'] ?>
|
|
|
|
|
</article>
|
2023-01-18 08:20:12 +00:00
|
|
|
|
|
|
|
|
|
<?php if (UOJProblem::info('type') == 'remote') : ?>
|
2023-01-28 01:30:50 +00:00
|
|
|
|
<hr>
|
|
|
|
|
|
2023-01-18 08:20:12 +00:00
|
|
|
|
<article class="mt-3 markdown-body remote-content">
|
2023-02-12 11:23:23 +00:00
|
|
|
|
<?= $problem_content['remote_content'] ?>
|
2023-01-18 08:20:12 +00:00
|
|
|
|
</article>
|
|
|
|
|
<?php endif ?>
|
2022-11-06 02:26:21 +00:00
|
|
|
|
</div>
|
|
|
|
|
<div class="tab-pane" id="submit">
|
|
|
|
|
<?php if ($pre_submit_check_ret !== true) : ?>
|
2023-02-07 10:38:24 +00:00
|
|
|
|
<p class="text-warning-emphasis h4"><?= $pre_submit_check_ret ?></p>
|
2022-11-06 02:26:21 +00:00
|
|
|
|
<?php elseif ($no_more_submission) : ?>
|
2023-02-07 10:38:24 +00:00
|
|
|
|
<p class="text-warning-emphasis h4"><?= $no_more_submission ?></p>
|
2022-11-06 02:26:21 +00:00
|
|
|
|
<?php else : ?>
|
|
|
|
|
<?php if ($submission_warning) : ?>
|
2023-02-07 10:38:24 +00:00
|
|
|
|
<p class="text-warning-emphasis h4"><?= $submission_warning ?></p>
|
2022-11-06 02:26:21 +00:00
|
|
|
|
<?php endif ?>
|
|
|
|
|
<?php if (isset($zip_answer_form)) : ?>
|
|
|
|
|
<?php $zip_answer_form->printHTML(); ?>
|
|
|
|
|
<hr />
|
|
|
|
|
<strong><?= UOJLocale::get('problems::or upload files one by one') ?><br /></strong>
|
|
|
|
|
<?php endif ?>
|
|
|
|
|
<?php $answer_form->printHTML(); ?>
|
|
|
|
|
<?php endif ?>
|
|
|
|
|
</div>
|
|
|
|
|
<?php if ($custom_test_enabled) : ?>
|
|
|
|
|
<div class="tab-pane" id="custom-test">
|
|
|
|
|
<?php $custom_test_form->printHTML(); ?>
|
|
|
|
|
</div>
|
|
|
|
|
<?php endif ?>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2022-09-27 08:42:24 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2022-11-12 11:09:47 +00:00
|
|
|
|
<!-- end left col -->
|
2022-11-06 02:26:21 +00:00
|
|
|
|
|
2022-11-12 11:09:47 +00:00
|
|
|
|
<!-- right col -->
|
2022-11-06 02:26:21 +00:00
|
|
|
|
<aside class="col-lg-3 mt-3 mt-lg-0">
|
|
|
|
|
<?php if (UOJContest::cur()) : ?>
|
2023-02-26 10:03:00 +00:00
|
|
|
|
<?= UOJContest::cur()->getContestCard() ?>
|
2022-09-25 10:28:43 +00:00
|
|
|
|
<?php endif ?>
|
|
|
|
|
|
2022-11-06 02:26:21 +00:00
|
|
|
|
<!-- 题目导航卡片 -->
|
|
|
|
|
<div class="card card-default mb-2">
|
|
|
|
|
<ul class="nav nav-pills nav-fill flex-column" role="tablist">
|
|
|
|
|
<li class="nav-item text-start">
|
|
|
|
|
<a href="#statement" class="nav-link active" role="tab" data-bs-toggle="pill" data-bs-target="#statement">
|
|
|
|
|
<i class="bi bi-journal-text"></i>
|
|
|
|
|
<?= UOJLocale::get('problems::statement') ?>
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="nav-item text-start">
|
|
|
|
|
<a href="#submit" class="nav-link" role="tab" data-bs-toggle="pill" data-bs-target="#submit">
|
|
|
|
|
<i class="bi bi-upload"></i>
|
|
|
|
|
<?= UOJLocale::get('problems::submit') ?>
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
<?php if ($custom_test_enabled) : ?>
|
|
|
|
|
<li class="nav-item text-start">
|
|
|
|
|
<a class="nav-link" href="#custom-test" role="tab" data-bs-toggle="pill" data-bs-target="#custom-test">
|
|
|
|
|
<i class="bi bi-braces"></i>
|
|
|
|
|
<?= UOJLocale::get('problems::custom test') ?>
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
<?php endif ?>
|
|
|
|
|
<?php if (!UOJContest::cur() || UOJContest::cur()->progress() >= CONTEST_FINISHED) : ?>
|
|
|
|
|
<li class="nav-item text-start">
|
2023-02-13 09:32:50 +00:00
|
|
|
|
<a href="/problem/<?= UOJProblem::info('id') ?>/solutions" class="nav-link">
|
2022-11-06 02:26:21 +00:00
|
|
|
|
<i class="bi bi-journal-bookmark"></i>
|
|
|
|
|
<?= UOJLocale::get('problems::solutions') ?>
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
<?php endif ?>
|
2022-11-23 08:31:37 +00:00
|
|
|
|
<li class="nav-item text-start">
|
|
|
|
|
<a class="nav-link" href="/submissions?problem_id=<?= UOJProblem::info('id') ?>">
|
|
|
|
|
<i class="bi bi-list-ul"></i>
|
|
|
|
|
<?= UOJLocale::get('submissions') ?>
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
2022-11-06 02:26:21 +00:00
|
|
|
|
<?php if (UOJContest::cur() && UOJContest::cur()->userCanSeeProblemStatistics(Auth::user())) : ?>
|
|
|
|
|
<li class="nav-item text-start">
|
2023-02-12 11:23:23 +00:00
|
|
|
|
<a class="nav-link" href="<?= UOJContestProblem::cur()->getUri('/statistics') ?>">
|
2022-11-06 02:26:21 +00:00
|
|
|
|
<i class="bi bi-graph-up"></i>
|
|
|
|
|
<?= UOJLocale::get('problems::statistics') ?>
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
<?php elseif (!UOJContest::cur()) : ?>
|
|
|
|
|
<li class="nav-item text-start">
|
2023-02-12 11:23:23 +00:00
|
|
|
|
<a class="nav-link" href="<?= UOJProblem::cur()->getUri('/statistics') ?>">
|
2022-11-06 02:26:21 +00:00
|
|
|
|
<i class="bi bi-graph-up"></i>
|
|
|
|
|
<?= UOJLocale::get('problems::statistics') ?>
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
<?php endif ?>
|
|
|
|
|
<?php if (UOJProblem::cur()->userCanManage(Auth::user())) : ?>
|
|
|
|
|
<li class="nav-item text-start">
|
2023-02-13 09:32:50 +00:00
|
|
|
|
<a class="nav-link" href="/problem/<?= UOJProblem::info('id') ?>/manage/statement">
|
2022-11-06 02:26:21 +00:00
|
|
|
|
<i class="bi bi-sliders"></i>
|
|
|
|
|
<?= UOJLocale::get('problems::manage') ?>
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
<?php endif ?>
|
|
|
|
|
</ul>
|
2022-12-04 12:44:51 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- 题目信息卡片 -->
|
|
|
|
|
<div class="card mb-2">
|
|
|
|
|
<ul class="list-group list-group-flush">
|
|
|
|
|
<li class="list-group-item d-flex justify-content-between align-items-center">
|
2022-12-23 13:41:46 +00:00
|
|
|
|
<span class="flex-shrink-0">
|
|
|
|
|
<?= UOJLocale::get('problems::uploader') ?>
|
|
|
|
|
</span>
|
2023-02-13 03:35:08 +00:00
|
|
|
|
<span class="text-end">
|
2022-12-23 13:41:46 +00:00
|
|
|
|
<?= UOJProblem::cur()->getUploaderLink() ?>
|
|
|
|
|
</span>
|
2022-12-04 12:44:51 +00:00
|
|
|
|
</li>
|
2023-01-18 08:20:12 +00:00
|
|
|
|
<li class="list-group-item d-flex justify-content-between align-items-center">
|
|
|
|
|
<span class="flex-shrink-0">
|
2023-02-12 11:23:23 +00:00
|
|
|
|
<?= UOJLocale::get('problems::problem source') ?>
|
2023-01-18 08:20:12 +00:00
|
|
|
|
</span>
|
2023-02-13 03:35:08 +00:00
|
|
|
|
<span class="text-end">
|
2023-01-18 08:20:12 +00:00
|
|
|
|
<?= UOJProblem::cur()->getProviderLink() ?>
|
|
|
|
|
</span>
|
|
|
|
|
</li>
|
2022-12-27 03:23:44 +00:00
|
|
|
|
<?php if (!UOJContest::cur() || UOJContest::cur()->progress() >= CONTEST_FINISHED) : ?>
|
2022-12-04 12:44:51 +00:00
|
|
|
|
<li class="list-group-item d-flex justify-content-between align-items-center">
|
2022-12-23 13:41:46 +00:00
|
|
|
|
<span class="flex-shrink-0">
|
2022-12-27 03:23:44 +00:00
|
|
|
|
<?= UOJLocale::get('problems::difficulty') ?>
|
2022-12-23 13:41:46 +00:00
|
|
|
|
</span>
|
2023-02-13 03:35:08 +00:00
|
|
|
|
<span class="text-end">
|
2022-12-27 03:23:44 +00:00
|
|
|
|
<?= UOJProblem::cur()->getDifficultyHTML() ?>
|
|
|
|
|
</span>
|
|
|
|
|
</li>
|
|
|
|
|
<?php if (Auth::check()) : ?>
|
|
|
|
|
<li class="list-group-item d-flex justify-content-between align-items-center">
|
|
|
|
|
<span class="flex-shrink-0">
|
|
|
|
|
<?= UOJLocale::get('problems::historical score') ?>
|
|
|
|
|
</span>
|
2022-12-04 12:44:51 +00:00
|
|
|
|
|
2023-02-13 03:35:08 +00:00
|
|
|
|
<?php $his_score = DB::selectSingle(["select max(score)", "from submissions", "where", ["problem_id" => UOJProblem::info('id'), "submitter" => Auth::id()]]) ?>
|
|
|
|
|
<a class="<?= is_null($his_score) ? '' : 'uoj-score' ?> text-end" href="<?= HTML::url('/submissions', ['params' => ['problem_id' => UOJProblem::info('id'), 'submitter' => Auth::id()]]) ?>">
|
2023-02-04 10:30:24 +00:00
|
|
|
|
<?= is_null($his_score) ? '无' : UOJSubmission::roundedScore($his_score) ?>
|
2022-12-27 03:23:44 +00:00
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
<?php endif ?>
|
|
|
|
|
<li class="list-group-item d-flex justify-content-between align-items-center">
|
|
|
|
|
<span class="flex-shrink-0">
|
|
|
|
|
<?= UOJLocale::get('problems::tags') ?>
|
|
|
|
|
</span>
|
2023-02-13 03:35:08 +00:00
|
|
|
|
<span class="text-end">
|
2022-12-27 03:23:44 +00:00
|
|
|
|
<?php if (UOJProblem::info('is_hidden')) : ?>
|
|
|
|
|
<a href="<?= HTML::url('/problems', ['params' => ['is_hidden' => 'on']]) ?>">
|
|
|
|
|
<span class="badge text-bg-danger">
|
|
|
|
|
<i class="bi bi-eye-slash-fill"></i>
|
|
|
|
|
<?= UOJLocale::get('hidden') ?>
|
|
|
|
|
</span>
|
|
|
|
|
</a>
|
|
|
|
|
<?php endif ?>
|
|
|
|
|
<?php foreach (UOJProblem::cur()->queryTags() as $tag) : ?>
|
|
|
|
|
<?= HTML::tag(
|
|
|
|
|
'a',
|
|
|
|
|
['class' => 'uoj-problem-tag'],
|
|
|
|
|
HTML::tag('span', ['class' => 'badge bg-secondary'], HTML::escape($tag))
|
|
|
|
|
) ?>
|
|
|
|
|
<?php endforeach ?>
|
|
|
|
|
</span>
|
2022-12-04 12:44:51 +00:00
|
|
|
|
</li>
|
|
|
|
|
<?php endif ?>
|
|
|
|
|
<li class="list-group-item d-flex justify-content-between align-items-center">
|
2022-12-23 13:41:46 +00:00
|
|
|
|
<span class="flex-shrink-0">
|
|
|
|
|
<?= UOJLocale::get('appraisal') ?>
|
|
|
|
|
</span>
|
2023-02-13 03:35:08 +00:00
|
|
|
|
<span class="text-end">
|
2022-12-23 13:41:46 +00:00
|
|
|
|
<?= UOJProblem::cur()->getZanBlock() ?>
|
|
|
|
|
</span>
|
2022-12-04 12:44:51 +00:00
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
2022-11-06 02:26:21 +00:00
|
|
|
|
</div>
|
2022-09-25 10:28:43 +00:00
|
|
|
|
|
2023-03-30 03:13:40 +00:00
|
|
|
|
<?php if (UOJProblem::info('hackable')) : ?>
|
|
|
|
|
<div class="alert alert-primary mb-2">
|
|
|
|
|
<i class="bi bi-info-circle"></i>
|
|
|
|
|
本题目开放 Hack。
|
|
|
|
|
</div>
|
|
|
|
|
<?php endif ?>
|
|
|
|
|
|
2022-11-06 02:26:21 +00:00
|
|
|
|
<!-- 附件 -->
|
2023-01-30 10:47:44 +00:00
|
|
|
|
<div class="card mb-2">
|
2023-02-12 11:23:23 +00:00
|
|
|
|
<div class="card-header fw-bold">
|
|
|
|
|
<?= UOJLocale::get('problems::attachments') ?>
|
|
|
|
|
</div>
|
2023-01-30 10:47:44 +00:00
|
|
|
|
<div class="list-group list-group-flush">
|
2022-11-06 02:26:21 +00:00
|
|
|
|
<?php if (UOJProblem::cur()->userCanDownloadTestData(Auth::user())) : ?>
|
2023-01-30 10:47:44 +00:00
|
|
|
|
<a class="list-group-item list-group-item-action" href="<?= HTML::url(UOJProblem::cur()->getMainDataUri()) ?>">
|
|
|
|
|
<i class="bi bi-hdd-stack"></i>
|
2023-02-12 11:23:23 +00:00
|
|
|
|
<?= UOJLocale::get('problems::test data') ?>
|
2022-11-06 02:26:21 +00:00
|
|
|
|
</a>
|
2023-01-30 10:47:44 +00:00
|
|
|
|
<?php endif ?>
|
|
|
|
|
<a class="list-group-item list-group-item-action" href="<?= HTML::url(UOJProblem::cur()->getAttachmentUri()) ?>">
|
|
|
|
|
<i class="bi bi-download"></i>
|
2023-02-12 11:23:23 +00:00
|
|
|
|
<?= UOJLocale::get('problems::attachments download') ?>
|
2023-01-30 10:47:44 +00:00
|
|
|
|
</a>
|
|
|
|
|
<a class="list-group-item list-group-item-action" href="<?= HTML::url(UOJProblem::cur()->getResourcesBaseUri()) ?>">
|
|
|
|
|
<i class="bi bi-folder2-open"></i>
|
2023-02-12 11:23:23 +00:00
|
|
|
|
<?= UOJLocale::get('problems::resources') ?>
|
2023-01-30 10:47:44 +00:00
|
|
|
|
</a>
|
|
|
|
|
</div>
|
2022-11-06 02:26:21 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
$sidebar_config = [];
|
|
|
|
|
if (UOJContest::cur() && UOJContest::cur()->progress() <= CONTEST_IN_PROGRESS) {
|
|
|
|
|
$sidebar_config['upcoming_contests_hidden'] = '';
|
|
|
|
|
}
|
2022-12-04 12:44:51 +00:00
|
|
|
|
|
2022-11-06 02:26:21 +00:00
|
|
|
|
uojIncludeView('sidebar', $sidebar_config);
|
|
|
|
|
?>
|
|
|
|
|
</aside>
|
|
|
|
|
<!-- end right col -->
|
2022-09-25 10:28:43 +00:00
|
|
|
|
|
|
|
|
|
</div>
|
2022-10-21 03:52:19 +00:00
|
|
|
|
|
|
|
|
|
<script>
|
2022-11-06 02:26:21 +00:00
|
|
|
|
$(document).ready(function() {
|
|
|
|
|
// Javascript to enable link to tab
|
|
|
|
|
var hash = location.hash.replace(/^#/, '');
|
|
|
|
|
if (hash) {
|
|
|
|
|
bootstrap.Tab.jQueryInterface.call($('.nav-pills a[href="#' + hash + '"]'), 'show').blur();
|
2022-10-21 03:52:19 +00:00
|
|
|
|
}
|
2022-09-25 10:28:43 +00:00
|
|
|
|
|
2022-11-06 02:26:21 +00:00
|
|
|
|
// Change hash for page-reload
|
|
|
|
|
$('.nav-pills a').on('shown.bs.tab', function(e) {
|
|
|
|
|
if (e.target.hash == '#statement') {
|
|
|
|
|
window.location.hash = '';
|
|
|
|
|
} else {
|
|
|
|
|
window.location.hash = e.target.hash;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
2022-09-27 08:42:24 +00:00
|
|
|
|
</script>
|
|
|
|
|
|
2019-06-11 02:59:04 +00:00
|
|
|
|
<?php echoUOJPageFooter() ?>
|