Skip to content

Commit

Permalink
Add indefinite upsolving capability
Browse files Browse the repository at this point in the history
This is a hack and should be replaced by a proper implementation,
adding specified (possibly infinite) additional time for each contestant.
  • Loading branch information
klenin committed Apr 7, 2012
1 parent 696c137 commit 37cd8a8
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions cgi-bin/main.pl
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,16 @@ sub download_problem
}


sub can_upsolve
{
my ($tag) = $dbh->selectrow_array(q~
SELECT CA.tag FROM contest_accounts CA
WHERE CA.contest_id = ? AND CA.account_id = ?~, undef,
$cid, $uid || 0);
!!(($tag || '') =~ /upsolve/);
}


sub problems_submit
{
# ðÒÏ×ÅÒÑÅÍ ÐÁÒÁÍÅÔÒÙ ÚÁÒÁÎÅÅ, ÞÔÏÂÙ ÎÅ ÄÅÌÁÔØ ÂÅÓÐÏÌÅÚÎÙÈ ÏÂÒÁÝÅÎÉÊ Ë âä.
Expand All @@ -883,7 +893,7 @@ sub problems_submit

$time_since_start >= 0
or return msg(80);
$time_since_finish <= 0 || $is_virtual
$time_since_finish <= 0 || $is_virtual || can_upsolve
or return msg(81);
!defined $status || $status < $cats::problem_st_disabled
or return msg(124);
Expand Down Expand Up @@ -1229,7 +1239,7 @@ sub problems_frame
{
my $my_is_team =
$is_jury || $contest->is_practice ||
$is_team && $contest->{time_since_finish} - $virtual_diff_time < 0;
$is_team && ($contest->{time_since_finish} - $virtual_diff_time < 0 || can_upsolve);
my $show_packages = 1;
unless ($is_jury)
{
Expand Down

0 comments on commit 37cd8a8

Please sign in to comment.