$cid = safeget("cid"); $contest = new ContestsTbl($cid); $contest->Get() or error("No such contest"); if (!is_contest_accessible($cid)) { if ($contest->detail['authtype'] == 'password' && !isset($_SESSION["access{$cid}"])) { MsgAndRedirect("contest_password.php?cid={$cid}"); } else { if (!is_contest_started($cid)) { error(_("This contest is not started yet.")); } else { error(_("You can't access to the contest")); } } } $problem = new ContestProblem($cid); if (!$problem->GetByFields(array())) { error("No problem found"); } global $conn; $rs = new RecordSet($conn); $rs->Query("SELECT cpid, COUNT(*) AS num FROM contest_status left join status on contest_status.sid = status.sid " . "WHERE cid = {$cid} and status = 'Accepted' GROUP BY cpid ORDER BY cpid"); $ac_num = array(); while ($rs->MoveNext()) { $ac_num[$rs->Fields['cpid']] = intval($rs->Fields['num']); } $rs->Query("SELECT cpid, COUNT(*) AS num FROM contest_status " . "WHERE cid = {$cid} GROUP BY cpid ORDER BY cpid"); $sm_num = array(); while ($rs->MoveNext()) { $sm_num[$rs->Fields['cpid']] = intval($rs->Fields['num']); } $rs->free_result();