├── html ├── diagram.dat ├── images │ ├── new.gif │ ├── back.gif │ ├── back_eva.gif │ ├── back_ntu.gif │ ├── balloon1.gif │ ├── balloon2.gif │ ├── balloon3.gif │ ├── balloon4.gif │ ├── balloon5.gif │ ├── balloon6.gif │ ├── crown0.gif │ ├── crown1.gif │ ├── crown2.gif │ ├── new_logo.jpg │ ├── red_card.png │ ├── xmas00.png │ ├── eva_login.jpg │ ├── 2012_Poster.jpg │ ├── new_logo_bg.jpg │ ├── new_logo_mid.jpg │ ├── yellow_card.png │ ├── judgegirl_logo.gif │ ├── new_logo_small.jpg │ ├── judgegirl_logo_bg.gif │ ├── judgegirl_logo_100x100.gif │ └── judgegirl_logo_300x300.gif ├── .htaccess ├── xmas.php ├── index.htm ├── footer_menu.php ├── logout.php ├── diagram.js ├── footnote.php ├── balloon.php ├── announce.php ├── menu.php ├── creat_image.php ├── compile_info.php ├── faq.php ├── loadfile.php ├── diagram │ ├── jpgraph_canvas.php │ ├── jpgraph_scatter.php │ ├── jpgraph_error.php │ ├── utils │ │ ├── gencolorchart.php │ │ └── adjimg.php │ ├── jpgraph_log.php │ └── jpgraph_line.php ├── log.php ├── program.php ├── config.php ├── login.php ├── download.php ├── index.php ├── vote.php ├── no_hand_in.php ├── news.php ├── login_log.php ├── diagram.php ├── passwd.php ├── sleepinglist.php ├── guest.php ├── recent_submission.php ├── cheat_examine.php ├── scorelist.php ├── problem.php ├── voteact.php ├── scoreboard.php └── list.php ├── judge ├── src │ ├── fixedtime │ │ ├── time-1.7.tar.gz │ │ ├── Makefile │ │ ├── time-1.7-ru_maxrss-is-in-kilobytes-on-Linux.patch │ │ ├── time-1.7-retstatfix.patch │ │ └── time-1.7-Recompute-CPU-usage-at-microsecond-level.patch │ ├── judgexec.c │ ├── Makefile │ ├── str_diff.cpp │ ├── int_diff.c │ ├── double_diff.c │ └── checkedit.cpp ├── bin │ ├── py_compile │ ├── ban_grep │ ├── inject │ └── token_diff ├── tools │ ├── exporter.sh │ ├── jsql │ ├── sleep_to │ ├── export.pl │ ├── sendmail.sh │ ├── end_quiz │ ├── prepare_quiz │ ├── start_quiz │ ├── jsqlcmd.sh │ ├── addvote.in │ ├── addprob.in │ ├── addvote.pl │ ├── addprob.pl │ ├── importquiz.pl │ ├── importscore.pl │ ├── adduser.pl │ └── create_table.pl ├── run.sh ├── JudgeBase.pm ├── README.hostadmin ├── Judger │ ├── JAVA.pm │ ├── PYTHON.pm │ ├── CPP.pm │ └── C.pm ├── README └── safe_func_list ├── .gitattributes ├── README.md ├── conf ├── config.pl.func ├── config.pl.object ├── config.pl.debug ├── config.pl.carg ├── config.pl.inject └── config.pl ├── _bashrc_judge ├── LOG ├── .gitignore ├── src └── _mysqlsetup.sh └── install.pl /html/diagram.dat: -------------------------------------------------------------------------------- 1 | -1 2 | 1 3 | 1 4 | -------------------------------------------------------------------------------- /html/images/new.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntuparallellab/judgegirl/HEAD/html/images/new.gif -------------------------------------------------------------------------------- /html/images/back.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntuparallellab/judgegirl/HEAD/html/images/back.gif -------------------------------------------------------------------------------- /html/images/back_eva.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntuparallellab/judgegirl/HEAD/html/images/back_eva.gif -------------------------------------------------------------------------------- /html/images/back_ntu.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntuparallellab/judgegirl/HEAD/html/images/back_ntu.gif -------------------------------------------------------------------------------- /html/images/balloon1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntuparallellab/judgegirl/HEAD/html/images/balloon1.gif -------------------------------------------------------------------------------- /html/images/balloon2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntuparallellab/judgegirl/HEAD/html/images/balloon2.gif -------------------------------------------------------------------------------- /html/images/balloon3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntuparallellab/judgegirl/HEAD/html/images/balloon3.gif -------------------------------------------------------------------------------- /html/images/balloon4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntuparallellab/judgegirl/HEAD/html/images/balloon4.gif -------------------------------------------------------------------------------- /html/images/balloon5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntuparallellab/judgegirl/HEAD/html/images/balloon5.gif -------------------------------------------------------------------------------- /html/images/balloon6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntuparallellab/judgegirl/HEAD/html/images/balloon6.gif -------------------------------------------------------------------------------- /html/images/crown0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntuparallellab/judgegirl/HEAD/html/images/crown0.gif -------------------------------------------------------------------------------- /html/images/crown1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntuparallellab/judgegirl/HEAD/html/images/crown1.gif -------------------------------------------------------------------------------- /html/images/crown2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntuparallellab/judgegirl/HEAD/html/images/crown2.gif -------------------------------------------------------------------------------- /html/images/new_logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntuparallellab/judgegirl/HEAD/html/images/new_logo.jpg -------------------------------------------------------------------------------- /html/images/red_card.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntuparallellab/judgegirl/HEAD/html/images/red_card.png -------------------------------------------------------------------------------- /html/images/xmas00.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntuparallellab/judgegirl/HEAD/html/images/xmas00.png -------------------------------------------------------------------------------- /html/.htaccess: -------------------------------------------------------------------------------- 1 | AuthType Basic 2 | AuthName "Preparing..." 3 | AuthUserFile /dev/null 4 | #Require valid-user 5 | -------------------------------------------------------------------------------- /html/images/eva_login.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntuparallellab/judgegirl/HEAD/html/images/eva_login.jpg -------------------------------------------------------------------------------- /html/xmas.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /html/images/2012_Poster.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntuparallellab/judgegirl/HEAD/html/images/2012_Poster.jpg -------------------------------------------------------------------------------- /html/images/new_logo_bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntuparallellab/judgegirl/HEAD/html/images/new_logo_bg.jpg -------------------------------------------------------------------------------- /html/images/new_logo_mid.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntuparallellab/judgegirl/HEAD/html/images/new_logo_mid.jpg -------------------------------------------------------------------------------- /html/images/yellow_card.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntuparallellab/judgegirl/HEAD/html/images/yellow_card.png -------------------------------------------------------------------------------- /html/images/judgegirl_logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntuparallellab/judgegirl/HEAD/html/images/judgegirl_logo.gif -------------------------------------------------------------------------------- /html/images/new_logo_small.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntuparallellab/judgegirl/HEAD/html/images/new_logo_small.jpg -------------------------------------------------------------------------------- /html/images/judgegirl_logo_bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntuparallellab/judgegirl/HEAD/html/images/judgegirl_logo_bg.gif -------------------------------------------------------------------------------- /judge/src/fixedtime/time-1.7.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntuparallellab/judgegirl/HEAD/judge/src/fixedtime/time-1.7.tar.gz -------------------------------------------------------------------------------- /html/images/judgegirl_logo_100x100.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntuparallellab/judgegirl/HEAD/html/images/judgegirl_logo_100x100.gif -------------------------------------------------------------------------------- /html/images/judgegirl_logo_300x300.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntuparallellab/judgegirl/HEAD/html/images/judgegirl_logo_300x300.gif -------------------------------------------------------------------------------- /html/index.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /judge/src/judgexec.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char * const argv[]){ 4 | if(argc) 5 | execv(argv[1], argv + 1); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /html/footer_menu.php: -------------------------------------------------------------------------------- 1 | 4 | 5 | 沒交作業旁聽名單 6 | 9 | -------------------------------------------------------------------------------- /judge/bin/py_compile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python2 2 | import sys 3 | import py_compile 4 | for f in sys.argv[1:]: 5 | try: 6 | py_compile.compile(f, f+'c', f, 1) 7 | except: 8 | raise 9 | sys.exit(1) 10 | -------------------------------------------------------------------------------- /judge/tools/exporter.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | read -a header 3 | while read x ; do 4 | echo "$x" | tr '\t' '\n' | \ 5 | for col in "${header[@]}" ; do 6 | read rec 7 | printf "%9s = '%s'\\n" "$col" "$rec" 8 | done 9 | echo "INSERT" 10 | done 11 | -------------------------------------------------------------------------------- /judge/src/Makefile: -------------------------------------------------------------------------------- 1 | UTILS = checkedit double_diff int_diff str_diff 2 | JEXEC = judgexec 3 | CFLAGS += -O2 4 | CXXFLAGS += -O2 5 | 6 | all: tools time 7 | 8 | tools: $(UTILS) $(JEXEC) 9 | mv -fv $(UTILS) ../bin 10 | mv -fv $(JEXEC) ../ 11 | 12 | time: 13 | cd fixedtime && make 14 | -------------------------------------------------------------------------------- /judge/tools/jsql: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | CONF="$HOME/public_html/judgegirl/config.php" 4 | user="$(cat $CONF | grep MySQLuser | cut -d\" -f 2)" 5 | pass="$(cat $CONF | grep MySQLpass | cut -d\" -f 2)" 6 | db="$(cat $CONF | grep MySQLdatabase | cut -d\" -f 2)" 7 | 8 | mysql -u "$user" "-p$pass" "$db" 9 | -------------------------------------------------------------------------------- /judge/tools/sleep_to: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # H M S 4 | if [ -z "$1" -o -z "$2" -o -z "$3" ] ; then 5 | echo "$0: " 6 | echo " sleep to H:M:S" 7 | exit 1 8 | fi 9 | 10 | sec(){ 11 | echo "$(( (($1)*60+$2)*60+$3 ))" 12 | } 13 | 14 | a=$(sec $1 $2 $3) 15 | b=$(sec `date '+%H %M %S'`) 16 | 17 | sleep $((a-b)) 18 | 19 | -------------------------------------------------------------------------------- /judge/tools/export.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | 3 | undef $/; # Read the whole input stream at once 4 | 5 | open ALL, ">list.csv"; 6 | while(<[A-Z]*>){ 7 | open FILE, $_; 8 | $input = ; 9 | close FILE; 10 | 11 | $input =~ /Username:\s*(\w+)\s*Password:\s*(\w+)/; 12 | print ALL "$1, $2\n"; 13 | } 14 | close ALL; 15 | -------------------------------------------------------------------------------- /judge/bin/ban_grep: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## read file from stdin 4 | t=`mktemp` 5 | cat > "$t" ; 6 | 7 | for arg ; do 8 | case "$arg" in 9 | _div) exp='[^/*]/[^/*]' ;; 10 | _mod) exp="\\<%\\>" ;; 11 | *) exp="\\<$arg\\>" ;; 12 | esac 13 | if grep -q "$exp" "$t"; then 14 | rm "$t" 15 | exit 1 16 | fi 17 | done 18 | 19 | rm "$t" 20 | exit 0 21 | -------------------------------------------------------------------------------- /judge/tools/sendmail.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | mail_suffix="ntu.edu.tw"; 3 | for i ; do 4 | user="${i/info_/}" 5 | ( 6 | echo "Subject: [C2011] Judgegirl System Account Information for $user" 7 | echo "From: C2011TA " 8 | echo "To: $user@$mail_suffix" 9 | echo "(IF you've alreay recieved this e-mail, please ignore this message)" 10 | cat "$i" 11 | ) | sendmail "$user@$mail_suffix" 12 | done 13 | -------------------------------------------------------------------------------- /html/logout.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 登出 6 | 7 | 8 |
9 |

Log Out

10 |
11 | 12 | 15 | 16 | 您已登出批改娘:)
17 | 請按這裡回到首頁 18 | 19 | 20 | -------------------------------------------------------------------------------- /judge/tools/end_quiz: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "$0: Started at $(date)"; 4 | 5 | #select name from volumes where name not in ( 6 | cat <"); 2 | document.write(" 38 | <?php echo $StrCourseName; ?> Problem List 39 | 45 | 46 | 47 |
48 |

Problem List

49 | 50 |
51 |
52 |
53 |

Submission Summary for user

54 | 66 |

$vtitle"; $vol_menu .= "$vtitle
"; ?>

67 | 71 | > 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | $deadline) ) 92 | continue; 93 | echo ""; 94 | echo ""; 99 | echo ""; 100 | echo " $deadline ? " style='color: red'" : "").">$deadline"; 101 | 102 | $query_trial = "SELECT COUNT(*) FROM $volume WHERE user = '${_SESSION['ID']}' AND number = $number"; 103 | $result_trial = mysql_query($query_trial); 104 | $count = mysql_result($result_trial, 0); 105 | echo ""; 106 | 107 | $query_score = "SELECT MAX(score) FROM $volume WHERE user = '${_SESSION['ID']}' AND number = $number AND valid = TRUE"; 108 | $result_score = mysql_query($query_score); 109 | echo ""; 110 | 111 | echo ""; 127 | //echo ""; 128 | echo "\n"; 129 | } 130 | } 131 | ?> 132 | 133 |
Problem NumberTitleDeadlineTrialsHi-scoreSubmit Program
$number"; 95 | if($_SESSION['SU'] && $testpath){ 96 | echo " rejudge"; 97 | } 98 | echo "".($url?"$title":$title)."$count".($count ? floatval(mysql_result($result_score, 0)): "N/A").""; 112 | if($testpath){ 113 | if($_SESSION['SU']){ 114 | echo "".($available?"submit":"N/A").""; 115 | echo " off":"ena >on").""; 116 | }else{ 117 | if($available == 1){ 118 | echo "submit"; 119 | }else{ 120 | echo "N/A"; 121 | } 122 | } 123 | }else{ 124 | echo "N/A"; 125 | } 126 | echo "".(($testpath && ($_SESSION['SU'] || $available == 1)) ? "submit" : "N/A")."
134 | 137 |
138 |
139 |
140 | 141 |
142 | 143 |
144 | 158 | 162 | 163 | 164 | -------------------------------------------------------------------------------- /html/voteact.php: -------------------------------------------------------------------------------- 1 | 0){ 69 | exit("You've voted."); 70 | } 71 | if( $time > $deadline ){ 72 | exit("Vote is over"); 73 | } 74 | if( array_search($_POST['vote'], $optlist) === FALSE ){ 75 | exit("Invalid vote option"); 76 | } 77 | $query = "INSERT INTO voterec (user, number, selection, time) VALUES ('$userid', '$number', '${_POST['vote']}', '$time')"; 78 | 79 | if (!mysql_query($query)) 80 | die('Invalid query: ' . mysql_error()); 81 | exit("The program has been submitted successfully.
Press here to return to the result page"); 82 | /* 83 | $command = "INSERT INTO $volume (user, number, program, time, ip, valid) VALUES ('$userid', '$number', '$program', '$time', '$ip', '$valid')"; 84 | if($_SESSION["guest"]) 85 | $command = "INSERT INTO $volume (user, number, program, time, ip, valid, comment) VALUES ('$userid', '$number', '$program', '$time', '$ip', '$valid', 'guest')"; 86 | 87 | if (!mysql_query($command)) 88 | die('Invalid query: ' . mysql_error()); 89 | exit("The program has been submitted successfully.
Press here to return to the result page"); 90 | */ 91 | } 92 | ?> 93 | 94 | 95 | 96 | 97 | <?php echo $PageTitle;?> 98 | 99 | 100 | 101 |
102 |

103 | 104 | 105 |
106 | 107 | 161 | 162 | 163 |

108 |

109 | 110 |
111 | 112 | 113 | 116 | 117 |
"; 118 | } 119 | ?> 120 |
121 |
122 | Result\n"; 125 | $query = "SELECT selection, COUNT(*) as c FROM voterec 126 | WHERE number = $number 127 | AND user IN (SELECT user FROM users WHERE class='user') 128 | GROUP BY selection"; 129 | $result = mysql_query($query); 130 | unset($vcount); 131 | foreach($optlist as $opt) 132 | $vcount[$opt] = 0; 133 | while($row = mysql_fetch_array($result)) 134 | $vcount[$row['selection']] = $row['c']; 135 | ?> 136 |
137 | 138 | 159 | 160 |
164 |
165 |
166 | 167 | 168 | 169 | 170 | -------------------------------------------------------------------------------- /judge/tools/create_table.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | 3 | use JudgeBase qw(connect_judgeDb); 4 | 5 | $dbh = connect_judgeDb(); 6 | 7 | # 8 | # Modify this part for changing default tables of option -u -p -l -v 9 | # 10 | 11 | @user_table = ("users"); 12 | @problems_table = ("problems"); 13 | @volume_table = ("volumes"); 14 | @logs_table = ("log"); 15 | @votes_table = ("votes"); 16 | @voterec_table = ("voterec"); 17 | 18 | # 19 | # 20 | # Main Program, edit with care 21 | # 22 | # 23 | use feature qw(switch); 24 | 25 | ( show_help() && exit 0 ) if @ARGV == 0; 26 | $force = (grep {$_ eq '-f'} @ARGV); 27 | $title = ''; 28 | for(@ARGV){ 29 | given($_){ 30 | when('-u'){ create_users(@user_table) if($force or confirm('users',@user_table)) ; } 31 | when('-p'){ create_problems(@problems_table) if($force or confirm('problems',@problems_table)) ; } 32 | when('-l'){ create_logs(@logs_table) if($force or confirm('logs',@logs_table)); } 33 | when('-v'){ create_volumes(@volume_table) if($force or confirm('volumes',@volume_table)); } 34 | when(/^-t/){ $title=$_ ; $title =~ s/-t// ; } 35 | when('-f'){ ; } 36 | when('-vote'){ 37 | if($force or confirm('vote',(@votes_table, @voterec_table))){ 38 | create_votes(@votes_table); 39 | create_voterec(@voterec_table); 40 | } 41 | } 42 | default{ 43 | my ($type, $name) = split(":", $_); 44 | if ($force or confirm("problemset".(($title ne '') && ", titled '$title', of type '$type'" || ""), ($name) )){ 45 | create_problemset(($name)); 46 | $dbh->do("insert into volumes ( name, type ) values ( '$name', '$type' );"); 47 | if($title ne ''){ 48 | $dbh->do("update volumes set title='$title' where name='$name';"); 49 | $title = ''; 50 | } 51 | } 52 | } 53 | } 54 | } 55 | 56 | $dbh->disconnect(); 57 | 58 | # 59 | # 60 | # Subroutines 61 | # 62 | # 63 | 64 | sub confirm { 65 | local $name = shift; 66 | do{ 67 | print "Create table of $name: ".join(", ", @_).", continue? [Y/n] "; 68 | $_ = ; 69 | chomp; 70 | }until(m/^[YyNn]$/ or $_ eq ''); 71 | return (m/^[Yy]$/ or $_ eq ''); 72 | } 73 | 74 | sub show_help { 75 | print "create_table.pl [OPTIONS] [-tTitle] Judge_type:problemset_name ... 76 | -t set the incoming problem set titled as <Title>. 77 | -u create users tables: ".join(", ",@user_table).". 78 | -p create problems tables: ".join(", ",@problems_table).". 79 | -l create log tables: ".join(", ",@logs_table).". 80 | -v create volume tables: ".join(", ",@volume_table).". 81 | -vote create vote table(desc and rec) ".join(", ",(@votes_table, @voterec_table))." 82 | -f create without confirm. 83 | To change the tables created by -u -p -l -v, please refer the source code. 84 | 85 | Example 86 | for new setup 87 | ./create_table.pl -u -p -l -v '-tTEST ProblemSet Title' jtype1:test jtype2:untitled_probset 88 | 89 | for new problem sets 90 | ./create_table.pl '-tProbSet Title1' Judge_type:set1 '-tProbSet Title2' Judge_type:set2 91 | 92 | NOTE: Judge_type should be one of the following: 93 | C 94 | CPP 95 | JAVA 96 | PYTHON 97 | " 98 | } 99 | 100 | sub create_users { 101 | foreach (@_){ 102 | $dbh->do(qq{ 103 | CREATE TABLE $_ ( 104 | user CHAR( 16 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL , 105 | passwd CHAR( 32 ) NULL DEFAULT NULL , 106 | class CHAR( 16 ) NULL DEFAULT 'user', 107 | name BLOB NOT NULL, 108 | PRIMARY KEY(user) 109 | ) 110 | }); 111 | } 112 | } 113 | 114 | sub create_problems { 115 | foreach (@_){ 116 | $dbh->do(qq{ 117 | CREATE TABLE $_( 118 | volume char(255), 119 | number tinyint(3) unsigned AUTO_INCREMENT, 120 | title varchar(255), 121 | available tinyint(1) DEFAULT 0, 122 | deadline datetime, 123 | file varchar(255) DEFAULT \"source.c\", 124 | url varchar(255), 125 | testpath varchar(255), 126 | usertest varchar(255), 127 | PRIMARY KEY (volume, number) 128 | ) 129 | }); 130 | } 131 | } 132 | 133 | sub create_problemset { 134 | foreach (@_){ 135 | $dbh->do(qq{ 136 | CREATE TABLE $_( 137 | user char(16), 138 | program blob, 139 | number tinyint unsigned DEFAULT 0, 140 | time datetime, 141 | trial tinyint unsigned AUTO_INCREMENT, 142 | score double, 143 | exec_time double, 144 | exec_space double, 145 | log text, 146 | exec_md5 char(32), 147 | ip char(39), 148 | valid tinyint(1), 149 | comment text, 150 | result varchar(255), 151 | PRIMARY KEY (user, number, trial) 152 | ) 153 | }); 154 | } 155 | } 156 | 157 | sub create_volumes { 158 | foreach (@_){ 159 | $dbh->do(qq{ 160 | CREATE TABLE $_ ( 161 | number TINYINT( 3 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , 162 | type CHAR( 255 ) NOT NULL , 163 | name CHAR( 255 ) NOT NULL , 164 | title VARCHAR( 255 ) NULL DEFAULT NULL , 165 | available TINYINT( 1 ) NULL DEFAULT 0 166 | ) 167 | }); 168 | } 169 | } 170 | 171 | sub create_logs { 172 | foreach (@_){ 173 | $dbh->do(qq{ 174 | CREATE TABLE $_ ( 175 | user CHAR( 16 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL , 176 | time DATETIME NULL DEFAULT NULL , 177 | ip CHAR( 20 ) NULL DEFAULT NULL 178 | ) 179 | }); 180 | } 181 | } 182 | 183 | sub create_votes { 184 | foreach (@_){ 185 | $dbh->do(qq{ 186 | CREATE TABLE $_( 187 | number tinyint(3) unsigned AUTO_INCREMENT, 188 | title varchar(255), 189 | description text, 190 | options text, 191 | available tinyint(1) DEFAULT 0, 192 | deadline datetime, 193 | PRIMARY KEY (number) 194 | ) 195 | }); 196 | } 197 | } 198 | 199 | sub create_voterec { 200 | foreach (@_){ 201 | $dbh->do(qq{ 202 | CREATE TABLE $_( 203 | user char(16), 204 | number tinyint unsigned DEFAULT 0, 205 | time datetime, 206 | selection text, 207 | comment text, 208 | PRIMARY KEY (user, number) 209 | ) 210 | }); 211 | } 212 | } 213 | 214 | -------------------------------------------------------------------------------- /judge/Judger/C.pm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -wU 2 | 3 | package Judger::C; 4 | 5 | # Judge system configuration 6 | # 2010-9-8: now centralized into tools/JudgeBase.pm 7 | use JudgeBase qw(htmlspecialchars psystem $SystemRoot); 8 | use Digest::MD5 qw{md5_hex}; 9 | 10 | #$Judgexec = "$SystemRoot/judgexec"; 11 | $SafeFuncList = "$SystemRoot/safe_func_list"; 12 | #$CC = '/usr/bin/gcc -c -std=c99 -Wall -fno-builtin -O1'; # ISO C99 standard 13 | #$LD = '/usr/bin/gcc'; 14 | 15 | undef $/; 16 | if( open SAFEFUNC, "$SafeFuncList" ){ 17 | @safe_func = split "\n", <SAFEFUNC>; 18 | close SAFEFUNC; 19 | } 20 | 21 | sub new { 22 | my($type) = $_[0]; 23 | my($self) = {}; 24 | bless($self, $type); 25 | return $self; 26 | } 27 | 28 | # Default settings 29 | sub setproblemconf { 30 | my ($self, $conf_path, $conf_valr) = @_; 31 | while( my($key, $val) = each (%$conf_valr) ){ 32 | eval "\$$key = '$val';"; 33 | } 34 | $Judgexec = "$SystemRoot/judgexec"; 35 | # $SafeFuncList = "$SystemRoot/safe_func_list"; 36 | $CC = '/usr/bin/gcc -c -std=c99 -Wall -fno-builtin -O1'; # ISO C99 standard 37 | $LD = '/usr/bin/gcc'; 38 | $IncPaths = ''; 39 | $CompileCmd = '$CC $IncPaths $source'; 40 | $ObjectList = '$objects'; 41 | $LinkLibs = '-lm'; 42 | $LinkCmd = '$LD $LinkLibs $objects'; 43 | 44 | $TestCmd = './a.out < $test_in > $user_out'; 45 | 46 | if(open CONFIG, "$conf_path"){ 47 | eval <CONFIG>; 48 | close CONFIG; 49 | } 50 | } 51 | 52 | sub compile { 53 | my ($self, $files_ref, $err_msg_ref) = @_; 54 | my $objects = "", $log = ""; 55 | foreach my $source (@$files_ref){ 56 | my $do_compile = 0; 57 | 58 | if( substr($source, -2) eq ".c" ){ 59 | $objects .= substr($source, 0, -2).".o "; 60 | $do_compile = 1; 61 | } 62 | if( substr($source, -3) eq ".cu" ){ 63 | $objects .= substr($source, 0, -3).".o "; 64 | $do_compile = 1; 65 | } 66 | if( substr($source, -4) eq ".cpp" ){ 67 | $objects .= substr($source, 0, -4).".o "; 68 | $do_compile = 1; 69 | } 70 | 71 | # Compilation 72 | 73 | if($do_compile){ 74 | my $msg = eval "psystem(qq{$CompileCmd 2>&1})"; 75 | if( $msg ){ 76 | $log .= sprintf $err_msg_ref->{WRN_COMPILE}, htmlspecialchars($msg); 77 | } 78 | if( $? ){ 79 | $log .= sprintf $err_msg_ref->{ERR_COMPILE}, htmlspecialchars($msg); 80 | return ($log, $?, ''); 81 | } 82 | } 83 | } 84 | 85 | # Allow only safe functions 86 | 87 | # combine objects first to avoid false alert 88 | # named as obj_o to avoid filename confliction. 89 | $merge_objects = eval qq{"$ObjectList"}; 90 | my $symbol_table = psystem("/usr/bin/ld -r $merge_objects -o obj_o ; /usr/bin/objdump -t obj_o"); 91 | my $danger = ""; 92 | while( $symbol_table =~ /\*UND\*\t\d+ (\w+)$/mg ){ 93 | if( ! ( grep { $1 eq $_ } @safe_func ) ){ 94 | $danger .= $1."\n"; 95 | } 96 | } 97 | if( $danger ){ 98 | $log .= sprintf $err_msg_ref->{ERR_SAFEFUNC}, $danger; 99 | return ($log, 1, ''); 100 | } 101 | 102 | # Linkage 103 | 104 | my $exec_md5 = ''; 105 | my $msg = eval "psystem(qq{$LinkCmd 2>&1})"; 106 | my $exec_ret = $?; 107 | if( $exec_ret ){ 108 | $log .= sprintf $err_msg_ref->{ERR_LINK}, htmlspecialchars($msg); 109 | } else { 110 | open EXEC, "a.out"; 111 | $exec_md5 = md5_hex <EXEC>; 112 | close EXEC; 113 | } 114 | 115 | return ($log, $exec_ret, $exec_md5); 116 | } 117 | 118 | sub jexec { 119 | my ($self, $test_path, $test_num, $test_in, $user_out) = @_; 120 | my $cmd = qq{ 121 | set -f; ulimit -t $TimeLimit; ulimit -v $SpaceLimit; 122 | exec $SystemRoot/bin/time --format="%e\\\\n%M\\\\n%y\\\\n" -o $ExecRecOut $Judgexec $TestCmd 123 | }; 124 | eval "print STDERR qq{$cmd\n}"; 125 | eval "exec qq{$cmd}"; 126 | } 127 | 128 | sub exec_msg { 129 | my ($self, $ret_val, $ret_msg, $err_msg_ref, $sig_name_ref) = @_; 130 | my $crash = 0, my $log = ''; 131 | my ($exec_time, $exec_space) = (undef, undef); 132 | 133 | undef $@; 134 | eval { 135 | # die strings should ends with "\n": 136 | # please refer to 2nd paragraph of http://perldoc.perl.org/functions/die.html 137 | 138 | # Handling status when judge.pl waits for timing program 139 | die (sprintf $err_msg_ref->{ERR_EXEC}."\n", 140 | $sig_name_ref->[$ret_val & 127].($ret_val & 128?" (Core dumped)":"")) 141 | if (($ret_val & 127) == 9); # This is killed by the judge.pl, so not a timer error. 142 | die (sprintf $err_msg_ref->{ERR_TIMER}."\n", "timer program not found") 143 | if ($ret_val == -1); 144 | die (sprintf $err_msg_ref->{ERR_TIMER}."\n", "timer program crashed: ". 145 | $sig_name_ref->[$ret_val & 127].($ret_val & 128?" (Core dumped)":"")) 146 | if ($ret_val & 127); 147 | 148 | # Handling timing program return status 149 | $ret_val = $ret_val >> 8; 150 | die (sprintf $err_msg_ref->{ERR_NOEXEC}."\n", "command not found") 151 | if ($ret_val == 127); 152 | die (sprintf $err_msg_ref->{ERR_NOEXEC}."\n", "command could not be executed") 153 | if ($ret_val == 126); 154 | die (sprintf $err_msg_ref->{ERR_TIMER}."\n", "timer program returns $ret_val") 155 | if ($ret_val > 0); 156 | 157 | # Read timing program result 158 | eval qq{\$exec_rec_fn = "$ExecRecOut";}; 159 | open RECORD, " < $exec_rec_fn" or 160 | die (sprintf $err_msg_ref->{ERR_TIMER}."\n", "cannot open timing result file $exec_rec_fn: $!"); 161 | ($exec_time, $exec_space, $waitstat) = split "\n", <RECORD>; 162 | print STDERR "time: $exec_time, memory: $exec_space, stat: $waitstat\n"; 163 | close RECORD; 164 | 165 | # Handling status timing program waits for the actual program 166 | die (sprintf $err_msg_ref->{ERR_NOEXEC}."\n", "command not found") 167 | if ($waitstat == -1); 168 | die (sprintf $err_msg_ref->{ERR_EXEC}."\n", 169 | $sig_name_ref->[$waitstat & 127].($waitstat & 128?" (Core dumped)":"")) 170 | if ($waitstat & 127); 171 | 172 | # Handling return status 173 | die $err_msg_ref->{ERR_EXIT}."\n" if ($waitstat >> 8); 174 | }; 175 | return ($crash = 1, $log = $@, $exec_time, $exec_space) if $@; 176 | 177 | $log = '你的程式已執行完畢。<br>'; 178 | return ($crash = 0, $log, $exec_time, $exec_space); 179 | } 180 | 181 | 1; 182 | -------------------------------------------------------------------------------- /html/diagram/jpgraph_line.php: -------------------------------------------------------------------------------- 1 | <?php 2 | /*======================================================================= 3 | // File: JPGRAPH_LINE.PHP 4 | // Description: Line plot extension for JpGraph 5 | // Created: 2001-01-08 6 | // Author: Johan Persson (johanp@aditus.nu) 7 | // Ver: $Id: jpgraph_line.php,v 1.6 2001/11/09 20:00:27 ljp Exp $ 8 | // 9 | // License: This code is released under GPL 2.0 10 | // 11 | //======================================================================== 12 | */ 13 | 14 | //=================================================== 15 | // CLASS LinePlot 16 | // Description: 17 | //=================================================== 18 | class LinePlot extends Plot{ 19 | var $filled=false; 20 | var $fill_color; 21 | var $mark=null; 22 | var $step_style=false, $center=false; 23 | var $line_style=1; // Default to solid 24 | //--------------- 25 | // CONSTRUCTOR 26 | function LinePlot(&$datay,$datax=false) { 27 | $this->Plot($datay,$datax); 28 | $this->mark = new PlotMark(); 29 | $this->mark->SetColor($this->color); 30 | } 31 | //--------------- 32 | // PUBLIC METHODS 33 | // Set style, filled or open 34 | function SetFilled($f=true) { 35 | $this->filled=$f; 36 | } 37 | 38 | function SetStyle($s) { 39 | $this->line_style=$s; 40 | } 41 | 42 | function SetStepStyle($f=true) { 43 | $this->step_style = $f; 44 | } 45 | 46 | function SetColor($c) { 47 | parent::SetColor($c); 48 | $this->mark->SetColor($this->color); 49 | } 50 | 51 | function SetFillColor($c,$f=true) { 52 | $this->fill_color=$c; 53 | $this->filled=$f; 54 | } 55 | 56 | function Legend(&$graph) { 57 | if( $this->legend!="" ) { 58 | if( $this->filled ) { 59 | $graph->legend->Add($this->legend, 60 | $this->fill_color,$this->mark); 61 | } else { 62 | $graph->legend->Add($this->legend, 63 | $this->color,$this->mark,$this->line_style); 64 | } 65 | } 66 | } 67 | 68 | function SetCenter($c=true) { 69 | $this->center=$c; 70 | } 71 | 72 | // Gets called before any axis are stroked 73 | function PreStrokeAdjust(&$graph) { 74 | if( $this->center ) { 75 | ++$this->numpoints; 76 | $a=0.5; $b=0.5; 77 | } else { 78 | $a=0; $b=0; 79 | } 80 | $graph->xaxis->scale->ticks->SetXLabelOffset($a); 81 | $graph->SetTextScaleOff($b); 82 | $graph->xaxis->scale->ticks->SupressMinorTickMarks(); 83 | } 84 | 85 | function Stroke(&$img,&$xscale,&$yscale) { 86 | $numpoints=count($this->coords[0]); 87 | if( isset($this->coords[1]) ) { 88 | if( count($this->coords[1])!=$numpoints ) 89 | die("JpGraph Error: Number of X and Y points are not equal.<br> 90 | Number of X-points:".count($this->coords[1])."<br> 91 | Number of Y-points:$numpoints"); 92 | else 93 | $exist_x = true; 94 | } 95 | else 96 | $exist_x = false; 97 | 98 | if( $exist_x ) 99 | $xs=$this->coords[1][0]; 100 | else 101 | $xs=0; 102 | 103 | $img->SetStartPoint($xscale->Translate($xs), 104 | $yscale->Translate($this->coords[0][0])); 105 | 106 | if( $this->filled ) { 107 | $cord[] = $xscale->Translate($xs); 108 | $cord[] = $yscale->Translate($yscale->GetMinVal()); 109 | } 110 | $cord[] = $xscale->Translate($xs); 111 | $cord[] = $yscale->Translate($this->coords[0][0]); 112 | $yt_old = $yscale->Translate($this->coords[0][0]); 113 | $img->SetColor($this->color); 114 | $img->SetLineWeight($this->weight); 115 | $img->SetLineStyle($this->line_style); 116 | for( $pnts=1; $pnts<$numpoints; ++$pnts) { 117 | if( $exist_x ) $x=$this->coords[1][$pnts]; 118 | else $x=$pnts; 119 | $xt = $xscale->Translate($x); 120 | $yt = $yscale->Translate($this->coords[0][$pnts]); 121 | $cord[] = $xt; 122 | $cord[] = $yt; 123 | if( $this->step_style ) { 124 | $img->StyleLineTo($xt,$yt_old); 125 | $img->StyleLineTo($xt,$yt); 126 | } 127 | else { 128 | if( $this->coords[0][$pnts] != "-" ) { 129 | $tmp1=$this->coords[0][$pnts]; 130 | $tmp2=$this->coords[0][$pnts-1]; 131 | if( is_numeric($tmp1) && is_numeric($tmp2) ) { 132 | $img->StyleLineTo($xt,$yt); 133 | } 134 | else { 135 | $img->SetStartPoint($xt,$yt); 136 | } 137 | } 138 | } 139 | $yt_old = $yt; 140 | } 141 | if( $this->filled ) { 142 | $cord[] = $xt; 143 | $cord[] = $yscale->Translate($yscale->GetMinVal()); 144 | $img->SetColor($this->fill_color); 145 | $img->FilledPolygon($cord); 146 | $img->SetColor($this->color); 147 | $img->Polygon($cord); 148 | } 149 | $adjust=0; 150 | if( $this->filled ) $adjust=2; 151 | for($i=$adjust; $i<count($cord)-$adjust; $i+=2) { 152 | if( is_numeric($this->coords[0][($i-$adjust)/2]) ) 153 | $this->mark->Stroke($img,$cord[$i],$cord[$i+1]); 154 | } 155 | } 156 | //--------------- 157 | // PRIVATE METHODS 158 | } // Class 159 | 160 | 161 | //=================================================== 162 | // CLASS AccLinePlot 163 | // Description: 164 | //=================================================== 165 | class AccLinePlot extends Plot { 166 | var $plots=null,$nbrplots=0,$numpoints=0; 167 | //--------------- 168 | // CONSTRUCTOR 169 | function AccLinePlot($plots) { 170 | $this->plots = $plots; 171 | $this->nbrplots = count($plots); 172 | $this->numpoints = $plots[0]->numpoints; 173 | } 174 | 175 | //--------------- 176 | // PUBLIC METHODS 177 | function Legend(&$graph) { 178 | foreach( $this->plots as $p ) 179 | $p->Legend($graph); 180 | } 181 | 182 | function Max() { 183 | $accymax=0; 184 | list($xmax,$dummy) = $this->plots[0]->Max(); 185 | foreach($this->plots as $p) { 186 | list($xm,$ym) = $p->Max(); 187 | $xmax = max($xmax,$xm); 188 | $accymax += $ym; 189 | } 190 | return array($xmax,$accymax); 191 | } 192 | 193 | function Min() { 194 | list($xmin,$ymin)=$this->plots[0]->Min(); 195 | foreach( $this->plots as $p ) { 196 | list($xm,$ym)=$p->Min(); 197 | $xmin=Min($xmin,$xm); 198 | $ymin=Min($ymin,$ym); 199 | } 200 | return array($xmin,$ymin); 201 | } 202 | 203 | // To avoid duplicate of line drawing code here we just 204 | // change the y-values for each plot and then restore it 205 | // after we have made the stroke. We must do this copy since 206 | // it wouldn't be possible to create an acc line plot 207 | // with the same graphs, i.e AccLinePlot(array($pl,$pl,$pl)); 208 | // since this method would have a side effect. 209 | function Stroke(&$img,&$xscale,&$yscale) { 210 | $img->SetLineWeight($this->weight); 211 | // Allocate array 212 | $coords[$this->nbrplots][$this->numpoints]=0; 213 | for($i=0; $i<$this->numpoints; $i++) { 214 | $coords[0][$i]=$this->plots[0]->coords[0][$i]; 215 | $accy=$coords[0][$i]; 216 | for($j=1; $j<$this->nbrplots; ++$j ) { 217 | $coords[$j][$i] = $this->plots[$j]->coords[0][$i]+$accy; 218 | $accy = $coords[$j][$i]; 219 | } 220 | } 221 | for($j=$this->nbrplots-1; $j>=0; --$j) { 222 | $p=$this->plots[$j]; 223 | for( $i=0; $i<$this->numpoints; ++$i) { 224 | $tmp[$i]=$p->coords[0][$i]; 225 | $p->coords[0][$i]=$coords[$j][$i]; 226 | } 227 | $p->Stroke($img,$xscale,$yscale); 228 | for( $i=0; $i<$this->numpoints; ++$i) 229 | $p->coords[0][$i]=$tmp[$i]; 230 | $p->coords[0][]=$tmp; 231 | } 232 | } 233 | } // Class 234 | 235 | /* EOF */ 236 | ?> 237 | -------------------------------------------------------------------------------- /html/scoreboard.php: -------------------------------------------------------------------------------- 1 | <?php 2 | include("config.php"); 3 | 4 | session_start(); 5 | 6 | if(!isset($_SESSION["ID"])) 7 | Header("Location: index.htm"); 8 | 9 | if(!mysql_connect($MySQLhost, $MySQLuser, $MySQLpass)) 10 | exit("Connection to database server failed."); 11 | if(!mysql_select_db($MySQLdatabase)) 12 | exit("Connection to database failed."); 13 | 14 | $user = $_SESSION["ID"]; 15 | $volume = $ContestEnv?$ProblemVolume:$_REQUEST["v"]; 16 | if( $volume && $volume != ''){ 17 | $queryv = "SELECT name, title from volumes where available = 1 and name = '$volume'"; 18 | $result = mysql_query($queryv); 19 | if(mysql_num_rows($result) == 0) 20 | exit('Volume not available/exist'); 21 | else{ 22 | $ProblemVolume = $volume; 23 | list($name, $voltitle) = mysql_fetch_row($result); 24 | } 25 | } 26 | ?> 27 | <html> 28 | <head> 29 | <meta http-equiv="Content-Type" content="text/html;CHARSET=utf-8"> 30 | <!--<meta http-equiv=refresh content=60>--> 31 | <title><?php echo $StrCourseName ?> Score Board 32 | 33 | 34 | 35 |
36 |

Score Board

37 | 38 |
39 |
40 | $title
"; 47 | } 48 | echo "

"; 49 | include("footnote.php"); 50 | exit; 51 | } 52 | echo "

".$voltitle."

\n"; 53 | ?> 54 |

Problem Solving Status

55 | 56 | 57 | 58 | "; 66 | # echo ""; 67 | echo $rec['title']; 68 | # echo ""; 69 | echo "\n"; 70 | } 71 | ?> 72 | 73 | 0 91 | GROUP BY V.user, V.number 92 | ) TMP GROUP BY score, number"; 93 | */ 94 | $result = mysql_query($query); 95 | 96 | foreach($nums as $number) 97 | $sleeping[$number] = $num_users; 98 | $ProblemMaxScore_backup = $ProblemMaxScore; 99 | $ProblemMaxScore = NULL; 100 | while($rec = mysql_fetch_assoc($result)){ 101 | $count[ceil($rec["score"])][$rec["number"]] += $rec["count"]; 102 | if($ProblemMaxScore === NULL || $ProblemMaxScore < $rec['score']) 103 | $ProblemMaxScore = $rec['score']; 104 | $sleeping[$rec["number"]] -= $rec["count"]; 105 | } 106 | if($ProblemMaxScore === NULL) 107 | $ProblemMaxScore = $ProblemMaxScore_backup; 108 | 109 | for($score = $ProblemMaxScore; $score >= 0; --$score){ 110 | $to_print = false; 111 | $print_str = ""; 112 | $print_str .= ""; 113 | for($number = 0; $number < $num_problems; $number++){ 114 | $ProblemNumber = $number + 1; 115 | $print_str .= sprintf("", 116 | $count[$score][$nums[$number]], $count[$score][$nums[$number]]*100.0/$num_users); 117 | if($count[$score][$nums[$number]]>0) 118 | $to_print = true; 119 | } 120 | $print_str .= "\n"; 121 | if($to_print || $ProblemMaxScore <= 20) 122 | echo $print_str; 123 | } 124 | ?> 125 | 126 | 127 | %d(%.2f%%)", $sleeping[$nums[$number]], $sleeping[$nums[$number]]*100.0/$num_users); 131 | } 132 | ?> 133 | 134 |
Score
$score%d (%.2f%%)
Sleeping
135 |
136 |
137 |

Statistics Diagram

138 | 20){ 164 | // echo "Sorry, this volume contains too many problems therefore is incapable of showing statics diagram

"; 165 | //}else 166 | //{ 167 | ?> 168 |
169 | "; 184 | if($Max > 300){ 185 | echo ""; 186 | echo ""; 187 | foreach($freq as $k => $v) 188 | echo ""; 189 | echo ""; 190 | foreach($freq as $k => $v) 191 | echo ""; 192 | echo "
Count$v
Score$k
"; 193 | } 194 | //} 195 | ?> 196 | 197 |
198 | 199 |
200 | 201 |
202 | 206 | 207 | 208 | -------------------------------------------------------------------------------- /html/list.php: -------------------------------------------------------------------------------- 1 | 28 | 44 | 45 | 46 | 47 | 48 | <?php echo $StrCourseName; ?> Judge Status 49 | 58 | 59 | 60 |
61 |

Judge Status

62 | Submission page"; 66 | include ("announce.php"); 67 | ?> 68 |
69 |
70 | 71 | 72 | 87 | 90 | 91 | 92 | 174 | 223 |
73 |

Submission list for

74 | 77 |
78 | 79 | 80 | List for user: 81 | 82 |
83 | 86 |
88 | 89 |
93 | 94 | 95 | 96 | User\n"; 99 | } 100 | ?> 101 | 102 | 103 | 104 | 105 | 106 | 107 | Comment\n"; 110 | //} 111 | ?> 112 | 113 | 114 | 115 | "; 130 | if( $_SESSION['SU'] ){ 131 | $query = "select name from users where user = '$user'"; 132 | $chinese_name = mysql_query($query); 133 | if(mysql_num_rows($chinese_name) > 0) 134 | $chinese_name = mysql_result($chinese_name, 0, 0); 135 | else 136 | $chinese_name = ''; 137 | echo ""; 144 | } 145 | echo ""; 146 | echo ""; 147 | if( is_null($score) ){ 148 | $wait_count = mysql_result(mysql_query("select count(*) from $volume where score is NULL and time < '$time'"), 0, 0); 149 | if( $wait_count == 0 ) 150 | echo ""; 151 | else 152 | echo ""; 153 | }else 154 | echo ""; 155 | echo ""; 156 | if ( is_null($score) ) 157 | echo ""; 158 | else 159 | echo ""; 160 | echo ""; 161 | if(strcmp($comment, "Red Card") == 0) 162 | echo ""; 163 | else if(strcmp($comment, "Yellow Card") == 0) 164 | echo ""; 165 | else 166 | echo ""; 167 | echo "\n"; 168 | } 169 | } 170 | ?> 171 | 172 |
Problem NumberTrial NumberScoreReceived TimeLog FileProgram Listing
"; 138 | if($userid == "") 139 | echo ""; 140 | echo "$user
$chinese_name"; 141 | if($userid == "") 142 | echo "
"; 143 | echo "
$num$trialJudging...Waiting for $wait_count ".($wait_count > 1 ? "submissions":"submission")."...".($valid ? $score : "$score (INVALID)")."$timeN/Adetailprogram" . ($comment ? $comment : " ") . "
173 |
175 | Histogram 178 | 179 | 180 | 181 | 182 | "; 183 | $query = "SELECT COUNT(*) FROM users WHERE class = 'user'"; 184 | $result = mysql_query($query); 185 | $total = mysql_result($result, 0, 0) - count($BlackList); 186 | $sleeping = $total; 187 | 188 | $query = "SELECT score, COUNT(score) FROM 189 | (SELECT MAX(V.score) AS score FROM $volume V, users U 190 | WHERE V.user = U.user AND U.class = 'user' AND V.number = $number AND V.valid = TRUE 191 | GROUP BY V.user 192 | ) as HS GROUP BY score DESC"; 193 | $result = mysql_query($query); 194 | 195 | for($i = 0; $i < mysql_num_rows($result); $i++){ 196 | list($score, $count) = mysql_fetch_row($result); 197 | $sleeping -= $count; 198 | 199 | echo ""; 200 | echo ""; 201 | if( $_SESSION['SU'] ) 202 | echo ""; 203 | else 204 | echo ""; 205 | echo "\n"; 206 | } 207 | 208 | echo ""; 209 | echo ""; 210 | if( $_SESSION['SU'] ) 211 | echo ""; 212 | else 213 | echo ""; 214 | echo "\n"; 215 | echo ""; 216 | echo ""; 217 | echo ""; 218 | echo "\n"; 219 | echo"
ScoreNumber
Of
Students
$score$count$count
Sleeping$sleeping$sleeping
Total$total
"; 220 | } 221 | ?> 222 |
224 |
225 |
226 | 229 |
230 |

Submit Program

231 | ">Press here 232 |
233 | 234 |
235 | 239 | 240 | 241 | --------------------------------------------------------------------------------