Exemple #1
0
$info['pid'] = $d['pid'];
$info['uid'] = $d['uid'];
$info['language'] = $d['lang'];
$info['pname'] = $d['filename'];
$info['datacnt'] = $d['datacnt'];
$info['timelimit'] = $d['timelimit'];
$info['memorylimit'] = $d['memorylimit'];
$info['plugin'] = $d['plugin'];
$info['compiledir'] = $cdir;
$Cp = new Compiler($info);
$free = $Cp->getgds($_POST['judger']);
if (!$free) {
    echo "No Grader!Please Wait and Retry.";
    exit;
}
$Cp->lock();
$Cp->getdir();
$csucc = $Cp->compile();
if (!$csucc) {
    echo "0!C";
    $Cp->s_detail = "C";
} else {
    for ($P = 1; $P <= $d[datacnt]; $P++) {
        $Cp->run($P);
        $Cp->getresult();
    }
    $Cp->getscore();
    echo "{$Cp->s_score}!{$Cp->s_detail}!" . $Cp->gettotaltime() . "!" . $Cp->getmemory();
}
$Cp->writedb_comp($_POST['csid']);
$Cp->unlock();