3 Star 11 Fork 2

BLumia/BLumiaOJ

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
problemstatistics.php 1.53 KB
一键复制 编辑 原始数据 按行查看 历史
<?php
session_start();
// Vars
require_once('./include/setting_oj.inc.php');
require_once('./include/common_const.inc.php');
// Prepares
if (isset($_GET['pid'])) {
$problem_id = intval($_GET['pid']);
} else {
exit("403 Missing Problem ID");
}
// Count solved
$sql=$pdo->prepare("SELECT `title`,`accepted`,`submit` FROM problem WHERE problem_id = ?");
$sql->execute(array($problem_id));
$problemInfo=$sql->fetch(PDO::FETCH_ASSOC);
$sql->closeCursor();
$sql=$pdo->prepare("SELECT `result`,count(1) count FROM solution WHERE problem_id=? AND result>=4 GROUP BY result ORDER BY result");
$sql->execute(array($problem_id));
$problemSubmits=$sql->fetchAll(PDO::FETCH_ASSOC);
$sql->closeCursor();
// Count other [TODO: Pages, Order by NOT score]
$sql=$pdo->prepare(
"SELECT * FROM (
SELECT solution_id, user_id, language, 10000000000000000000 + time *100000000000 + memory *100000 + code_length score, in_date
FROM solution
WHERE problem_id =? AND result =4 ORDER BY score, in_date
)b
RIGHT JOIN (
SELECT count( * ) att, user_id, min( 10000000000000000000 + time *100000000000 + memory *100000 + code_length ) score
FROM solution
WHERE problem_id =? AND result =4 GROUP BY user_id ORDER BY score, in_date
)c ON b.score = c.score AND b.user_id = c.user_id ORDER BY c.score, in_date LIMIT 0, 50"
);
$sql->execute(array($problem_id,$problem_id));
$acceptedList = $sql->fetchAll(PDO::FETCH_ASSOC);
$sql->closeCursor();
//print_r($acceptedList);
//Page Includes
require("./pages/problemstatistics.php");
?>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/blumia/BLumiaOJ.git
[email protected]:blumia/BLumiaOJ.git
blumia
BLumiaOJ
BLumiaOJ
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385