Exemple #1
0
function RejudgeProblem(&$arg)
{
    global $conn;
    $rs = new RecordSet($conn);
    $pid = safefetch($arg, 'pid');
    $cid = tryfetch($arg, 'cid', 0);
    $rejudge_all = tryfetch($arg, 'rjall', true);
    $cpid = $pid;
    if ($cid) {
        $prob = new ContestProblem($cid, $cpid);
        if (!$prob->Get()) {
            error("No such problem in the contest");
        }
        $pid = $prob->detail['pid'];
    }
    $prob = new ProblemTbl($pid);
    if (!$prob->Get()) {
        error("No such problem.");
    }
    if (!$rejudge_all) {
        $rejudge_cond = "and status!='Accepted'";
    } else {
        $prob->update['accepted'] = 0;
        $prob->Update();
        $rejudge_cond = "";
        if ($cid) {
            $rs->Query("UPDATE ranklist SET accepted = 0, submissions = 0 WHERE pid='{$cpid}' AND cid='{$cid}'");
        }
    }
    $rs->Query("INSERT INTO queue (sid,cid,cpid) select sid,'{$cid}','{$cpid}' from status where pid='{$pid}' {$rejudge_cond}");
    $rs->insert_id();
    $count_inserted = $rs->affected_rows();
    if ($cid) {
        MsgAndRedirect("../status.php?cid={$cid}&cpid={$cpid}", "Total {$count_inserted} submissions will be rejudged.");
    } else {
        MsgAndRedirect("../status.php?pid={$cpid}", "Total {$count_inserted} submissions will be rejudged.");
    }
}
Exemple #2
0
function tryrequest($p, $default = "")
{
    return tryfetch($_REQUEST, $p, $default);
}