Пример #1
0
function monitor_ural()
{
    $html = file_get_html("http://acm.timus.ru/problemset.aspx?space=1&page=all");
    $table = $html->find("table.problemset", 0);
    $rows = $table->find("tr");
    for ($j = 2; $j < sizeof($rows) - 1; $j++) {
        $row = $rows[$j];
        $pid = trim($row->find("td", 1)->plaintext);
        if (problem_get_id_from_virtual("Ural", $pid)) {
            continue;
        }
    }
    $i++;
}
Пример #2
0
function replay_crawl_hust($cid)
{
    $res = array();
    $html = file_get_html("http://acm.hust.edu.cn/contest.php?cid={$cid}");
    if ($html->find("table", 1) == null) {
        $res["code"] = 1;
        return $res;
    }
    $titles = $html->find("table", 1)->find("tr");
    for ($i = 1; $i < sizeof($titles); $i++) {
        $title = $titles[$i]->find("td", 1)->plaintext;
        //echo $title;
        if ($title == null) {
            continue;
        }
        $tname = problem_get_id_from_virtual("HUST", trim(strstr($title, " ", true)));
        if ($tname == null) {
            $res["code"] = 1;
            return $res;
        }
        $res["vpid" . ($i - 1)] = $tname;
    }
    preg_match('/Start Time: <.*>(.*)</sU', $html, $matches);
    $sttime = $matches[1];
    preg_match('/End Time: <.*>(.*)</sU', $html, $matches);
    $edtime = $matches[1];
    $title = trim($html->find("h3", 0)->plaintext);
    $res["start_time"] = $sttime;
    $res["end_time"] = $edtime;
    $res["name"] = $title;
    $res["description"] = $res["repurl"] = "http://acm.hust.edu.cn/contestrank.php?cid={$cid}";
    $res["ctype"] = "hust";
    $res["code"] = 0;
    $res["isvirtual"] = 0;
    return $res;
}
Пример #3
0
<?php

include_once dirname(__FILE__) . "/../functions/problems.php";
$vname = convert_str($_GET['vname']);
$vid = convert_str($_GET['vid']);
$ret["code"] = 1;
if ($vname == "BNU") {
    $ret["pid"] = $vid;
    $ret["title"] = problem_get_title($ret["pid"]);
    if ($ret["title"]) {
        $ret["code"] = 0;
    }
} else {
    $ret["pid"] = problem_get_id_from_virtual($vname, $vid);
    $ret["title"] = problem_get_title($ret["pid"]);
    if ($ret["pid"] && $ret["title"]) {
        $ret["code"] = 0;
    }
}
if ($ret["code"] == 0 && problem_hidden($ret["pid"])) {
    unset($ret);
    $ret["code"] = 1;
}
echo json_encode($ret);