valid() || UOJResponse::page404(); UOJGroupAssignment::cur()->userCanView(['ensure' => true]); ?>

作业:

getProblemIDs(); $usernames = UOJGroup::cur()->getUsernames(); $n_users = count($users); $submission_end_time = min(new DateTime(), UOJGroupAssignment::info('end_time')); // standings: rank => [total_score, [username, realname], scores[]] $standings = []; foreach ($usernames as $username) { $user = UOJUser::query($username); $row = [0, [$user['username'], $user['realname']], []]; $conds = DB::land([ "submitter" => $user['username'], ["unix_timestamp(submit_time)", "<=", $submission_end_time->getTimestamp()], ]); foreach ($problems as $problem_id) { $submission = DB::selectFirst([ "select", DB::fields(["id", "score"]), "from submissions", "where", [ "problem_id" => $problem_id, $conds, ], "order by score desc, id desc", ]); if ($submission) { $row[2][] = [ (int)$submission['id'], UOJSubmission::roundedScore($submission['score']), ]; $row[0] = UOJSubmission::roundedScore($row[0] + $submission['score']); } else { $row[2][] = null; } } $standings[] = $row; } usort($standings, function ($lhs, $rhs) { if ($lhs[0] != $rhs[0]) { return $rhs[0] - $lhs[0]; } return strcmp($lhs[1][0], $rhs[1][0]); }); ?>