예제 #1
0
파일: contest.php 프로젝트: RX78NY1/hustoj
    //	echo $cid;
    //	echo "<br>";
    //	echo $sql;
    //	echo "<br>";
    $result = mysql_query($sql);
    $cnt = 0;
    echo "<table width=60%><tr class=toprow><td width=5><td width=34%><b>Problem ID</b><td width=65%><b>Title</b></tr>";
    while ($row = mysql_fetch_object($result)) {
        if ($cnt & 1) {
            echo "<tr class=oddrow>";
        } else {
            echo "<tr class=evenrow>";
        }
        echo "<td>";
        if (isset($_SESSION['user_id'])) {
            echo check_ac($cid, $cnt);
        }
        echo "<td>{$row->pid} Problem {$PID[$cnt]}\n\t\t\t<td><a href='problem.php?cid={$cid}&pid={$cnt}'>{$row->title}</a>\n\t\t\t</tr>";
        $cnt++;
    }
    echo "</table><br>";
    mysql_free_result($result);
    echo "[<a href='status.php?cid={$cid}'>Status</a>]";
    echo "[<a href='contestrank.php?cid={$cid}'>Standing</a>]";
    echo "[<a href='conteststatistics.php?cid={$cid}'>Statistics</a>]";
    echo "</center>";
} else {
    require_once "oj-header.php";
    ?>
<title>Contest List</title>
<?php 
예제 #2
0
            exit(0);
        }
    }
    if (!$contest_ok) {
        $view_errors = "{$MSG_PRIVATE_WARNING} <a href=contestrank.php?cid={$cid}>{$MSG_WATCH_RANK}</a>";
        require "template/" . $OJ_TEMPLATE . "/error.php";
        exit(0);
    }
    $sql = "select * from (SELECT `problem`.`title` as `title`,`problem`.`problem_id` as `pid`,source as source, `contest_problem`.`num` as pnum\n    FROM `contest_problem`,`problem`\n    WHERE `contest_problem`.`problem_id`=`problem`.`problem_id` AND `problem`.`defunct`='N'\n    AND `contest_problem`.`contest_id`={$cid}\n  ) problem\n  left join (select problem_id pid1,count(1) accepted from solution where result=4 and contest_id={$cid} group by pid1) p1 on problem.pid=p1.pid1\n  left join (select problem_id pid2,count(1) submit from solution where contest_id={$cid}  group by pid2) p2 on problem.pid=p2.pid2\n  order by pnum\n  ";
    $result = mysql_query($sql);
    $view_problemset = array();
    $cnt = 0;
    while ($row = mysql_fetch_object($result)) {
        $view_problemset[$cnt][0] = "";
        if (isset($_SESSION['user_id'])) {
            $view_problemset[$cnt][0] = check_ac($cid, $cnt);
        }
        $view_problemset[$cnt][1] = chr($cnt + ord('A'));
        $view_problemset[$cnt][2] = "<a href='problem.php?cid={$cid}&pid={$cnt}'>{$row->title}</a>";
        $view_problemset[$cnt][3] = $row->accepted;
        $view_problemset[$cnt][4] = $row->submit;
        $cnt++;
    }
    mysql_free_result($result);
} else {
    $sql = "SELECT * FROM `contest` WHERE `defunct`='N' ORDER BY `contest_id` DESC limit 100";
    $result = mysql_query($sql);
    $view_contest = array();
    $i = 0;
    while ($row = mysql_fetch_object($result)) {
        $view_contest[$i][0] = $row->contest_id;