userCanSeeProblemStatistics(Auth::user()) || UOJResponse::page403(); } UOJProblem::cur()->userCanView(Auth::user(), ['ensure' => true]); function scoreDistributionData() { $data = array(); $res = DB::selectAll([ "select score, count(*) from submissions", "where", [ "problem_id" => UOJProblem::info('id'), ["score", "is not", null], UOJSubmission::sqlForUserCanView(Auth::user(), UOJProblem::cur()) ], "group by score", "order by score" ], DB::NUM); $has_score_0 = false; $has_score_100 = false; foreach ($res as $row) { if ($row[0] == 0) { $has_score_0 = true; } else if ($row[0] == 100) { $has_score_100 = true; } $score = UOJSubmission::roundedScore($row[0]) * 100; $data[] = ['score' => $score, 'count' => $row[1]]; } if (!$has_score_0) { array_unshift($data, ['score' => 0, 'count' => 0]); } if (!$has_score_100) { $data[] = ['score' => 10000, 'count' => 0]; } return $data; } $data = scoreDistributionData(); $pre_data = $data; $suf_data = $data; for ($i = 0; $i < count($data); $i++) { $data[$i]['score'] /= 100; } for ($i = 1; $i < count($data); $i++) { $pre_data[$i]['count'] += $pre_data[$i - 1]['count']; } for ($i = count($data) - 1; $i > 0; $i--) { $suf_data[$i - 1]['count'] += $suf_data[$i]['count']; } $submissions_sort_by_choice = !isset($_COOKIE['submissions-sort-by-code-length']) ? 'time' : 'tot_size'; if (UOJContest::cur()) { $PageTitle = UOJProblem::cur()->getTitle(['with' => 'letter', 'simplify' => true]); } else { $PageTitle = UOJProblem::cur()->getTitle(['with' => 'id']); } ?>