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")); } $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} 分钟提交,没法再交咯"; } } if (!$no_more_submission) { if ($max_cnt != -1) { $cnt = UOJContestProblem::cur()->queryUserSubmissionCountInContest(Auth::user()); if ($cnt >= $max_cnt) { $no_more_submission = "提交次数已达到 {$cnt} 次,没法再交咯"; } } } 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; } } } // 比赛导航 $tabs_info = [ 'dashboard' => [ 'name' => UOJLocale::get('contests::contest dashboard'), 'url' => UOJContest::cur()->getUri(), ], 'submissions' => [ 'name' => UOJLocale::get('contests::contest submissions'), 'url' => UOJContest::cur()->getUri('/submissions'), ], 'standings' => [ 'name' => UOJLocale::get('contests::contest standings'), 'url' => UOJContest::cur()->getUri('/standings'), ], ]; if (UOJContest::cur()->progress() > CONTEST_TESTING) { $tabs_info['after_contest_standings'] = [ 'name' => UOJLocale::get('contests::after contest standings'), 'url' => UOJContest::cur()->getUri('/after_contest_standings'), ]; $tabs_info['self_reviews'] = [ 'name' => UOJLocale::get('contests::contest self reviews'), 'url' => UOJContest::cur()->getUri('/self_reviews'), ]; } if (UOJContest::cur()->userCanManage(Auth::user())) { $tabs_info['backstage'] = [ 'name' => UOJLocale::get('contests::contest backstage'), 'url' => UOJContest::cur()->getUri('/backstage'), ]; } } $submission_requirement = UOJProblem::cur()->getSubmissionRequirement(); $custom_test_requirement = UOJProblem::cur()->getCustomTestRequirement(); $custom_test_enabled = $custom_test_requirement && $pre_submit_check_ret === true && UOJProblem::info('type') != 'remote'; function handleUpload($zip_file_name, $content, $tot_size) { global $is_participating; $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]; $content['remote_judge'] = true; $content['config'][] = ['remote_submit_type', $submit_type]; if ($submit_type != 'bot') { $content['no_rejudge'] = true; $content['config'][] = ['remote_account_data', $_POST['answer_remote_account_data']]; } if ($submit_type == 'archive') { $content['remote_submission_id'] = $_POST['answer_remote_submission_id']; $content['config'][] = ['remote_submission_id', $_POST['answer_remote_submission_id']]; $content['config'] = array_values(array_filter( $content['config'], function ($row) { return !strEndWith($row[0], '_language'); }, )); $zip_file = new ZipArchive(); $zip_file->open(UOJContext::storagePath() . $zip_file_name, ZipArchive::OVERWRITE); $zip_file->addFromString('answer.code', ''); $zip_file->close(); $tot_size = 0; } } $id = UOJSubmission::onUpload($zip_file_name, $content, $tot_size, $is_participating); if ($is_participating) { // redirect by UOJForm } else { redirectTo("/submission/$id"); } } 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()) { echo json_encode(null); } elseif (!UOJCustomTestSubmission::cur()->hasJudged()) { echo json_encode([ 'judged' => false, 'waiting' => true, 'html' => UOJCustomTestSubmission::cur()->getStatusDetailsHTML(), ]); } else { ob_start(); $styler = new CustomTestSubmissionDetailsStyler(); if (!UOJCustomTestSubmission::cur()->userPermissionCodeCheck(Auth::user(), UOJProblem::cur()->getExtraConfig('view_details_type'))) { $styler->fade_all_details = true; } echoJudgmentDetails(UOJCustomTestSubmission::cur()->getResult('details'), $styler, 'custom_test_details'); $result = ob_get_contents(); ob_end_clean(); echo json_encode([ 'judged' => true, 'waiting' => false, 'html' => UOJCustomTestSubmission::cur()->getStatusDetailsHTML(), 'result' => $result ]); } die(); } $custom_test_form = newSubmissionForm( 'custom_test', $custom_test_requirement, 'FS::randomAvailableTmpFileName', 'handleCustomTestUpload' ); $custom_test_form->appendHTML('
'); $custom_test_form->succ_href = 'none'; $custom_test_form->extra_validator = function () { if (UOJCustomTestSubmission::cur() && !UOJCustomTestSubmission::cur()->hasJudged()) { return '上一个测评尚未结束'; } return ''; }; $custom_test_form->setAjaxSubmit(<<config['submit_button']['text'] = UOJLocale::get('problems::run'); $custom_test_form->runAtServer(); } if (empty($submission_requirement)) { $no_more_submission = UOJLocale::get('problems::cannot submit'); } 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 '交题交得太快啦,坐下来喝杯阿华田休息下吧?'; } return ''; }; if (UOJProblem::cur()->userCanUploadSubmissionViaZip(Auth::user())) { $zip_answer_form = newZipSubmissionForm( 'zip_answer', $submission_requirement, 'FS::randomAvailableSubmissionFileName', 'handleUpload' ); $zip_answer_form->extra_validators[] = $submission_extra_validator; $zip_answer_form->succ_href = $is_participating ? UOJContest::cur()->getUri('/submissions') : '/submissions'; $zip_answer_form->runAtServer(); } $answer_form = newSubmissionForm( 'answer', $submission_requirement, 'FS::randomAvailableSubmissionFileName', 'handleUpload' ); 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); $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) { return $_POST['answer_remote_submit_type'] == 'bot' || json_decode($data) !== null ? '' : '无效数据'; }, null); $answer_form->add('answer_remote_submission_id', '', function ($id) { return $_POST['answer_remote_submit_type'] != 'archive' || validateUInt($id) ? '' : '无效 ID'; }, null); $answer_form->appendHTML(<<Remote Judge 配置
EOD); } $answer_form->extra_validator = $submission_extra_validator; $answer_form->succ_href = $is_participating ? UOJContest::cur()->getUri('/submissions') : '/submissions'; $answer_form->runAtServer(); } $conf = UOJProblem::cur()->getProblemConf(); if (UOJContest::cur()) { $pageTitle = UOJProblem::cur()->getTitle(['with' => 'letter', 'simplify' => true]); } else { $pageTitle = UOJProblem::cur()->getTitle(['with' => 'id']); } ?>

getTitle(['with' => 'letter', 'simplify' => true]) ?> getTitle(['with' => 'id']) ?>

getVal('time_limit', 1) : null; $memory_limit = $conf instanceof UOJProblemConf ? $conf->getVal('memory_limit', 256) : null; $judge_type = $conf instanceof UOJProblemConf ? $conf->getNonTraditionalJudgeType() : null; } else if (UOJProblem::info('type') == 'remote') { $time_limit = UOJProblem::cur()->getExtraConfig('time_limit'); $memory_limit = UOJProblem::cur()->getExtraConfig('memory_limit'); $judge_type = 'remote_judge'; } ?>
: : :

findInContests(); ?>
:
    $a->contest->info['start_time'] < $b->contest->info['start_time']); ?> userCanView(Auth::user())) : ?>
  • contest->getLink(['class' => 'alert-link text-decoration-underline']) ?> (contest->info['start_time_str'] ?>)


printHTML(); ?>

printHTML(); ?>
printHTML(); ?>