@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | 'WRONG_ANSWER'=>"Wrong Answer", |
| 109 | 109 | ]; |
| 110 | 110 | |
| 111 | - $hdu_v = [ |
|
| 111 | + $hdu_v=[ |
|
| 112 | 112 | 'Accepted'=>"Accepted", |
| 113 | 113 | "Presentation Error"=>"Presentation Error", |
| 114 | 114 | 'Time Limit Exceeded'=>"Time Limit Exceed", |
@@ -345,9 +345,9 @@ discard block |
||
| 345 | 345 | } catch (Exception $e) { |
| 346 | 346 | } |
| 347 | 347 | } elseif ($row['oid']==7 || $row['oid']==9) { |
| 348 | - $host = [7=>'uva.onlinejudge.org', 9=>'icpcarchive.ecs.baylor.edu'][$row['oid']]; |
|
| 349 | - $handle = [7=>'uva', 9=>'uvalive'][$row['oid']]; |
|
| 350 | - $list = [7=>$uvaList, 9=>$uvalList][$row['oid']]; |
|
| 348 | + $host=[7=>'uva.onlinejudge.org', 9=>'icpcarchive.ecs.baylor.edu'][$row['oid']]; |
|
| 349 | + $handle=[7=>'uva', 9=>'uvalive'][$row['oid']]; |
|
| 350 | + $list=[7=>$uvaList, 9=>$uvalList][$row['oid']]; |
|
| 351 | 351 | var_dump($host); |
| 352 | 352 | var_dump($handle); |
| 353 | 353 | var_dump($list); |
@@ -372,23 +372,23 @@ discard block |
||
| 372 | 372 | ]; |
| 373 | 373 | $this->MODEL->updateSubmission($row['sid'], $sub); |
| 374 | 374 | } |
| 375 | - }else if($row['oid']==8) { |
|
| 375 | + } else if ($row['oid']==8) { |
|
| 376 | 376 | try { |
| 377 | - $sub = []; |
|
| 378 | - $response = Requests::get("http://acm.hdu.edu.cn/status.php?first=".$row['remote_id']); |
|
| 379 | - preg_match ('/<\/td><td>[\\s\\S]*?<\/td><td>[\\s\\S]*?<\/td><td>([\\s\\S]*?)<\/td><td>[\\s\\S]*?<\/td><td>(\\d*?)MS<\/td><td>(\\d*?)K<\/td>/', $response->body, $match); |
|
| 380 | - if(strpos('Runtime error',trim(strip_tags($match[1])))!==false) $sub['verdict'] = 'Runtime Error'; |
|
| 381 | - else $sub['verdict'] = $hdu_v[trim(strip_tags($match[1]))]; |
|
| 382 | - preg_match ("/<td>(\\d*?)MS<\/td><td>(\\d*?)K<\/td>/", $response->body, $matches); |
|
| 383 | - $sub['remote_id'] = $row['remote_id']; |
|
| 384 | - $sub['time'] = intval($matches[1]); |
|
| 385 | - $sub['memory'] = intval($matches[2]); |
|
| 377 | + $sub=[]; |
|
| 378 | + $response=Requests::get("http://acm.hdu.edu.cn/status.php?first=".$row['remote_id']); |
|
| 379 | + preg_match('/<\/td><td>[\\s\\S]*?<\/td><td>[\\s\\S]*?<\/td><td>([\\s\\S]*?)<\/td><td>[\\s\\S]*?<\/td><td>(\\d*?)MS<\/td><td>(\\d*?)K<\/td>/', $response->body, $match); |
|
| 380 | + if (strpos('Runtime error', trim(strip_tags($match[1])))!==false) $sub['verdict']='Runtime Error'; |
|
| 381 | + else $sub['verdict']=$hdu_v[trim(strip_tags($match[1]))]; |
|
| 382 | + preg_match("/<td>(\\d*?)MS<\/td><td>(\\d*?)K<\/td>/", $response->body, $matches); |
|
| 383 | + $sub['remote_id']=$row['remote_id']; |
|
| 384 | + $sub['time']=intval($matches[1]); |
|
| 385 | + $sub['memory']=intval($matches[2]); |
|
| 386 | 386 | // $sub['score'] = ($sub['verdict'] == 'Accepted')?100:0; |
| 387 | 387 | |
| 388 | - if($sub['verdict'] == 'Compile Error') { |
|
| 389 | - $ret = Requests::get("http://acm.hdu.edu.cn/viewerror.php?rid=".$row['remote_id']); |
|
| 390 | - preg_match ("/<pre>([\\s\\S]*?)<\/pre>/", $ret->body, $match); |
|
| 391 | - $sub['compile_info'] = trim(strip_tags($match[0])); |
|
| 388 | + if ($sub['verdict']=='Compile Error') { |
|
| 389 | + $ret=Requests::get("http://acm.hdu.edu.cn/viewerror.php?rid=".$row['remote_id']); |
|
| 390 | + preg_match("/<pre>([\\s\\S]*?)<\/pre>/", $ret->body, $match); |
|
| 391 | + $sub['compile_info']=trim(strip_tags($match[0])); |
|
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | $this->MODEL->updateSubmission($row['sid'], $sub); |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | */ |
| 441 | 441 | private function get_last_uva($earliest, $host, $handle) |
| 442 | 442 | { |
| 443 | - $ret = []; |
|
| 443 | + $ret=[]; |
|
| 444 | 444 | if (!$earliest) { |
| 445 | 445 | return $ret; |
| 446 | 446 | } |