From b300254ee1f308c440d8e8d8129fb863b6ec9599 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 30 Dec 2012 16:05:36 +0330 Subject: Making the legacy more useful Added a brief installation guide in README along with etc config file samples. Added a couple of useful start and kill scripts in utils folder. Added two sample problems (one normal one interactive) along with testers in utils folder. --- CHANGELOG | 54 +++++++++++++++++++++++++-------------- README | 33 +++++++++++++++++++++--- base/daemon.sh | 2 +- base/init.sh | 2 +- etc/group | 1 + etc/pam.d/jail | 2 ++ etc/pam.d/su | 15 +++++++++++ etc/passwd | 4 +++ etc/security/chroot.conf | 6 +++++ etc/security/limits.d/judge.conf | 5 ++++ problems/bs/bs.cpp | 28 ++++++++++++++++++++ problems/bs/config | 3 +++ problems/bs/inits/.init | 1 + problems/bs/inits/0.init | 1 + problems/bs/inits/1.init | 1 + problems/bs/inits/10.init | 1 + problems/bs/inits/11.init | 1 + problems/bs/inits/12.init | 1 + problems/bs/inits/13.init | 1 + problems/bs/inits/14.init | 1 + problems/bs/inits/15.init | 1 + problems/bs/inits/16.init | 1 + problems/bs/inits/17.init | 1 + problems/bs/inits/18.init | 1 + problems/bs/inits/19.init | 1 + problems/bs/inits/2.init | 1 + problems/bs/inits/20.init | 1 + problems/bs/inits/21.init | 1 + problems/bs/inits/22.init | 1 + problems/bs/inits/23.init | 1 + problems/bs/inits/24.init | 1 + problems/bs/inits/3.init | 1 + problems/bs/inits/4.init | 1 + problems/bs/inits/5.init | 1 + problems/bs/inits/6.init | 1 + problems/bs/inits/7.init | 1 + problems/bs/inits/8.init | 1 + problems/bs/inits/9.init | 1 + problems/bs/inits/a.php | 8 ++++++ problems/bs/inits/x | 25 ++++++++++++++++++ problems/bs/inputs/0.in | 1 + problems/bs/inputs/1.in | 1 + problems/bs/inputs/10.in | 1 + problems/bs/inputs/11.in | 1 + problems/bs/inputs/12.in | 1 + problems/bs/inputs/13.in | 1 + problems/bs/inputs/14.in | 1 + problems/bs/inputs/15.in | 1 + problems/bs/inputs/16.in | 1 + problems/bs/inputs/17.in | 1 + problems/bs/inputs/18.in | 1 + problems/bs/inputs/19.in | 1 + problems/bs/inputs/2.in | 1 + problems/bs/inputs/20.in | 1 + problems/bs/inputs/21.in | 1 + problems/bs/inputs/22.in | 1 + problems/bs/inputs/23.in | 1 + problems/bs/inputs/24.in | 1 + problems/bs/inputs/3.in | 1 + problems/bs/inputs/4.in | 1 + problems/bs/inputs/5.in | 1 + problems/bs/inputs/6.in | 1 + problems/bs/inputs/7.in | 1 + problems/bs/inputs/8.in | 1 + problems/bs/inputs/9.in | 1 + problems/bs/tester | Bin 0 -> 10361 bytes problems/bs/tester.cpp | 28 ++++++++++++++++++++ problems/hellow/config | 3 +++ problems/hellow/hellow.cpp | 12 +++++++++ problems/hellow/inits/0.init | 1 + problems/hellow/inits/1.init | 1 + problems/hellow/inputs/0.in | 1 + problems/hellow/inputs/1.in | 1 + problems/hellow/tester | Bin 0 -> 10213 bytes problems/hellow/tester.cpp | 23 +++++++++++++++++ utils/bs-tester.sh | 30 ++++++++++++++++++++++ utils/daemon.sh | 18 +++++++++++++ utils/hellow-tester.sh | 30 ++++++++++++++++++++++ utils/jfsck.sh | 10 ++++++++ utils/setenv.sh | 5 ++++ 80 files changed, 378 insertions(+), 24 deletions(-) create mode 100644 etc/group create mode 100644 etc/pam.d/jail create mode 100644 etc/pam.d/su create mode 100644 etc/passwd create mode 100644 etc/security/chroot.conf create mode 100644 etc/security/limits.d/judge.conf create mode 100644 problems/bs/bs.cpp create mode 100644 problems/bs/config create mode 100644 problems/bs/inits/.init create mode 100644 problems/bs/inits/0.init create mode 100644 problems/bs/inits/1.init create mode 100644 problems/bs/inits/10.init create mode 100644 problems/bs/inits/11.init create mode 100644 problems/bs/inits/12.init create mode 100644 problems/bs/inits/13.init create mode 100644 problems/bs/inits/14.init create mode 100644 problems/bs/inits/15.init create mode 100644 problems/bs/inits/16.init create mode 100644 problems/bs/inits/17.init create mode 100644 problems/bs/inits/18.init create mode 100644 problems/bs/inits/19.init create mode 100644 problems/bs/inits/2.init create mode 100644 problems/bs/inits/20.init create mode 100644 problems/bs/inits/21.init create mode 100644 problems/bs/inits/22.init create mode 100644 problems/bs/inits/23.init create mode 100644 problems/bs/inits/24.init create mode 100644 problems/bs/inits/3.init create mode 100644 problems/bs/inits/4.init create mode 100644 problems/bs/inits/5.init create mode 100644 problems/bs/inits/6.init create mode 100644 problems/bs/inits/7.init create mode 100644 problems/bs/inits/8.init create mode 100644 problems/bs/inits/9.init create mode 100644 problems/bs/inits/a.php create mode 100644 problems/bs/inits/x create mode 100644 problems/bs/inputs/0.in create mode 100644 problems/bs/inputs/1.in create mode 100644 problems/bs/inputs/10.in create mode 100644 problems/bs/inputs/11.in create mode 100644 problems/bs/inputs/12.in create mode 100644 problems/bs/inputs/13.in create mode 100644 problems/bs/inputs/14.in create mode 100644 problems/bs/inputs/15.in create mode 100644 problems/bs/inputs/16.in create mode 100644 problems/bs/inputs/17.in create mode 100644 problems/bs/inputs/18.in create mode 100644 problems/bs/inputs/19.in create mode 100644 problems/bs/inputs/2.in create mode 100644 problems/bs/inputs/20.in create mode 100644 problems/bs/inputs/21.in create mode 100644 problems/bs/inputs/22.in create mode 100644 problems/bs/inputs/23.in create mode 100644 problems/bs/inputs/24.in create mode 100644 problems/bs/inputs/3.in create mode 100644 problems/bs/inputs/4.in create mode 100644 problems/bs/inputs/5.in create mode 100644 problems/bs/inputs/6.in create mode 100644 problems/bs/inputs/7.in create mode 100644 problems/bs/inputs/8.in create mode 100644 problems/bs/inputs/9.in create mode 100755 problems/bs/tester create mode 100644 problems/bs/tester.cpp create mode 100644 problems/hellow/config create mode 100644 problems/hellow/hellow.cpp create mode 100644 problems/hellow/inits/0.init create mode 100644 problems/hellow/inits/1.init create mode 100644 problems/hellow/inputs/0.in create mode 100644 problems/hellow/inputs/1.in create mode 100755 problems/hellow/tester create mode 100644 problems/hellow/tester.cpp create mode 100755 utils/bs-tester.sh create mode 100755 utils/daemon.sh create mode 100755 utils/hellow-tester.sh create mode 100755 utils/jfsck.sh create mode 100755 utils/setenv.sh diff --git a/CHANGELOG b/CHANGELOG index 828b6fe..d159a87 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,27 +1,43 @@ -Core v0.4 (01-Jul-2011): (first public release) - - ? +NOTE: HELLIJUDGE IS DEPRECATED AS OF November 22nd, 2012 -Core v0.5 (07-Jul-2011): - - ? +Legacy v0.9 (30-Dec-2012): + - Added a brief installation guide in README along with etc config file samples. + - Added a couple of useful start and kill scripts in utils folder. + - Added two sample problems (one normal one interactive) along with + testers in utils folder. -Core v0.6 (08-Jul-2011): - - few changes in coding style - - now core.py reads problem config from file instead of stdin +HELLIJUDGE DEPRECATED (22-Nov-2012) -Core v0.7.rc1 (12-Jul-2011): (aka, idu) - - unite daemon and init. +Core v0.8 (15-Aug-2011): + - major 'memnory and time limit casting' bug fixed -Core v0.7.rc2 (12-Jul-2011): (aka, 2D) - - two different daemons: one for judging a code with - only one test case (call it A), and second one to judge all test cases - for a given code (call it B). note that B uses A for each test. +Core v0.71 (10-Aug-2011): + - minor 'timeout termination signal' bug fixed -Core v0.7.rc3 (12-Jul-2011): - - connecting core and update using a socket. +Core v0.7 (15-Jul-2011): (first stable release. git repo is now available) + - many minor bugs fixed Core v0.7.rc4 (12-Jul-2011): (chosen as v0.7) - - update.py reads contest configuration from mysql and according to it, - tells needed information to judge (eg. do break when a test fails or not) + - update.py reads contest configuration from mysql and according to it, + tells needed information to judge (eg. do break when a test fails or not) -Core v0.7 (15-Jul-2011): (first stable release. git repo is now available) - - many minor bugs fixed +Core v0.7.rc3 (12-Jul-2011): + - connecting core and update using a socket. + +Core v0.7.rc2 (12-Jul-2011): (aka, 2D) + - two different daemons: one for judging a code with + only one test case (call it A), and second one to judge all test cases + for a given code (call it B). note that B uses A for each test. + +Core v0.7.rc1 (12-Jul-2011): (aka, idu) + - unite daemon and init. + +Core v0.6 (08-Jul-2011): + - few changes in coding style + - now core.py reads problem config from file instead of stdin + +Core v0.5 (07-Jul-2011): + - ? + +Core v0.4 (01-Jul-2011): (first public release) + - ? diff --git a/README b/README index 4bf59ef..7d4c5d0 100644 --- a/README +++ b/README @@ -6,13 +6,40 @@ TO BE COMPLETED, asap! Install & Configuration + First, install Fedora Linux or something close! + Edit /etc files according to the ones is etc directory of judge. They + are the settings responsible for jailing and limitations. + Edit utils/setenv.sh and set your judge directory in it, then run it. + + Now build a jail. You can find our prepared jail at: + https://github.com/jux-foundation/hellijudge-jail + or you can build your own, but remember to add compiler scripts from + our repo. + + Based on your own configuration, do the following: + mkdir /mnt/jail/home + mkdir /mnt/jail/source + ln -s /mnt/jail $JUDGE_PREFIX/jail + + mkdir /var/log/jury + ln -s /var/log/jury $JUDGE_PREFIX/log + + Start the daemon, then run utils/hellow-tester.sh to test the judge. + Run utils/bs-tester.sh to test the interactive feature. + + If anything didn't workout, don't worry! I'd be surprised if it did! + Contact me at dinovirus [@] NOSPAM [.] gmail [.] com + TO BE COMPLETED, asap! Documentation + Start: run utils/daemon.sh + Kill: run utils/jfsck.sh + TO BE COMPLETED, asap! License - Copyright (C) 2011 Hamed Saleh & Mahrud Sayrafi + Copyright (C) 2011-`date +%Y` Hamed Saleh & Mahrud Sayrafi This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,5 +52,5 @@ GNU General Public License for more details. Authors & Contact information - Hamed Saleh - Mahrud Sayrafi + Hamed Saleh + Mahrud Sayrafi diff --git a/base/daemon.sh b/base/daemon.sh index de75186..8301b3f 100644 --- a/base/daemon.sh +++ b/base/daemon.sh @@ -17,7 +17,7 @@ # along with this program. If not, see . PID=$$ -LOCK="/var/run/judge.pid" +LOCK="$JUDGE_PREFIX/judge.pid" echo $PID >$LOCK echo "Judge daemon started ... pid=$PID" >&2 diff --git a/base/init.sh b/base/init.sh index 638080d..98d653b 100644 --- a/base/init.sh +++ b/base/init.sh @@ -30,7 +30,7 @@ fi sh $LOGGER LOG error "init started ..." # TODO seams buggy FIXME -LOCK="/var/run/judgeinit.pid" +LOCK="$JUDGE_PREFIX/judge.pid" while [ -e $LOCK ] do LOCK_PID=`cat $LOCK` diff --git a/etc/group b/etc/group new file mode 100644 index 0000000..26377e1 --- /dev/null +++ b/etc/group @@ -0,0 +1 @@ +judge:x:1024:judge diff --git a/etc/pam.d/jail b/etc/pam.d/jail new file mode 100644 index 0000000..a3563bc --- /dev/null +++ b/etc/pam.d/jail @@ -0,0 +1,2 @@ +#%PAM-1.0 +session required pam_chroot.so diff --git a/etc/pam.d/su b/etc/pam.d/su new file mode 100644 index 0000000..b5d6504 --- /dev/null +++ b/etc/pam.d/su @@ -0,0 +1,15 @@ +#%PAM-1.0 +auth sufficient pam_rootok.so +# Uncomment the following line to implicitly trust users in the "wheel" group. +#auth sufficient pam_wheel.so trust use_uid +# Uncomment the following line to require a user to be in the "wheel" group. +#auth required pam_wheel.so use_uid +auth include system-auth +auth include postlogin +account sufficient pam_succeed_if.so uid = 0 use_uid quiet +account include system-auth +password include system-auth +session include system-auth +session include postlogin +session optional pam_xauth.so +session include jail diff --git a/etc/passwd b/etc/passwd new file mode 100644 index 0000000..b4ccc5c --- /dev/null +++ b/etc/passwd @@ -0,0 +1,4 @@ +root:x:0:0:root:/root:/bin/bash +bin:x:1:1:bin:/bin:/sbin/nologin +nobody:x:99:99:Nobody:/:/sbin/nologin +judge:x:1024:1024:Judge:/mnt/jail:/bin/bash diff --git a/etc/security/chroot.conf b/etc/security/chroot.conf new file mode 100644 index 0000000..0e2c5a1 --- /dev/null +++ b/etc/security/chroot.conf @@ -0,0 +1,6 @@ +# /etc/security/chroot.conf +# format: +# username_regex chroot_dir +#matthew /home + +judge /mnt/jail diff --git a/etc/security/limits.d/judge.conf b/etc/security/limits.d/judge.conf new file mode 100644 index 0000000..fab4281 --- /dev/null +++ b/etc/security/limits.d/judge.conf @@ -0,0 +1,5 @@ +# Default limits for user judge + +@judge - core 0 +@judge - nproc 1 +@judge - as 524288 diff --git a/problems/bs/bs.cpp b/problems/bs/bs.cpp new file mode 100644 index 0000000..37600e6 --- /dev/null +++ b/problems/bs/bs.cpp @@ -0,0 +1,28 @@ +#include + +using namespace std; + +int main() +{ + //cerr << "chert" << endl; + long long max; cin >> max; + + long long s = 0, e = max + 1; + + while (e - s > 1) + { + long long m = (e + s) / 2; + cout << m << endl; + string res; + cin >> res; + //cerr << "responce to " << m << " is " << res << endl; + if (res == "correct") + break; + else if (res == "high") + e = m; + else + s = m; + } + + return 0; +} diff --git a/problems/bs/config b/problems/bs/config new file mode 100644 index 0000000..27eea01 --- /dev/null +++ b/problems/bs/config @@ -0,0 +1,3 @@ +24 +default +normal 1 16384 %n.in diff --git a/problems/bs/inits/.init b/problems/bs/inits/.init new file mode 100644 index 0000000..4085abc --- /dev/null +++ b/problems/bs/inits/.init @@ -0,0 +1 @@ +817688420639124 diff --git a/problems/bs/inits/0.init b/problems/bs/inits/0.init new file mode 100644 index 0000000..dc6f4a8 --- /dev/null +++ b/problems/bs/inits/0.init @@ -0,0 +1 @@ +218 diff --git a/problems/bs/inits/1.init b/problems/bs/inits/1.init new file mode 100644 index 0000000..1b1c131 --- /dev/null +++ b/problems/bs/inits/1.init @@ -0,0 +1 @@ +280 diff --git a/problems/bs/inits/10.init b/problems/bs/inits/10.init new file mode 100644 index 0000000..fa2fd6e --- /dev/null +++ b/problems/bs/inits/10.init @@ -0,0 +1 @@ +835997987 diff --git a/problems/bs/inits/11.init b/problems/bs/inits/11.init new file mode 100644 index 0000000..d1c6f48 --- /dev/null +++ b/problems/bs/inits/11.init @@ -0,0 +1 @@ +395233934 diff --git a/problems/bs/inits/12.init b/problems/bs/inits/12.init new file mode 100644 index 0000000..9f30a1e --- /dev/null +++ b/problems/bs/inits/12.init @@ -0,0 +1 @@ +403475449 diff --git a/problems/bs/inits/13.init b/problems/bs/inits/13.init new file mode 100644 index 0000000..e7eb148 --- /dev/null +++ b/problems/bs/inits/13.init @@ -0,0 +1 @@ +479944972 diff --git a/problems/bs/inits/14.init b/problems/bs/inits/14.init new file mode 100644 index 0000000..fd8cf20 --- /dev/null +++ b/problems/bs/inits/14.init @@ -0,0 +1 @@ +15952939 diff --git a/problems/bs/inits/15.init b/problems/bs/inits/15.init new file mode 100644 index 0000000..1b1b29a --- /dev/null +++ b/problems/bs/inits/15.init @@ -0,0 +1 @@ +681270219720 diff --git a/problems/bs/inits/16.init b/problems/bs/inits/16.init new file mode 100644 index 0000000..82279e5 --- /dev/null +++ b/problems/bs/inits/16.init @@ -0,0 +1 @@ +367209446112 diff --git a/problems/bs/inits/17.init b/problems/bs/inits/17.init new file mode 100644 index 0000000..ee2d522 --- /dev/null +++ b/problems/bs/inits/17.init @@ -0,0 +1 @@ +978266150219 diff --git a/problems/bs/inits/18.init b/problems/bs/inits/18.init new file mode 100644 index 0000000..6ad0771 --- /dev/null +++ b/problems/bs/inits/18.init @@ -0,0 +1 @@ +82343693519 diff --git a/problems/bs/inits/19.init b/problems/bs/inits/19.init new file mode 100644 index 0000000..8b42161 --- /dev/null +++ b/problems/bs/inits/19.init @@ -0,0 +1 @@ +27189505666 diff --git a/problems/bs/inits/2.init b/problems/bs/inits/2.init new file mode 100644 index 0000000..425151f --- /dev/null +++ b/problems/bs/inits/2.init @@ -0,0 +1 @@ +40 diff --git a/problems/bs/inits/20.init b/problems/bs/inits/20.init new file mode 100644 index 0000000..9192d00 --- /dev/null +++ b/problems/bs/inits/20.init @@ -0,0 +1 @@ +32143969796887 diff --git a/problems/bs/inits/21.init b/problems/bs/inits/21.init new file mode 100644 index 0000000..dc81f13 --- /dev/null +++ b/problems/bs/inits/21.init @@ -0,0 +1 @@ +547740858706792 diff --git a/problems/bs/inits/22.init b/problems/bs/inits/22.init new file mode 100644 index 0000000..8d17a5f --- /dev/null +++ b/problems/bs/inits/22.init @@ -0,0 +1 @@ +7973866115106 diff --git a/problems/bs/inits/23.init b/problems/bs/inits/23.init new file mode 100644 index 0000000..100d914 --- /dev/null +++ b/problems/bs/inits/23.init @@ -0,0 +1 @@ +428224552539201 diff --git a/problems/bs/inits/24.init b/problems/bs/inits/24.init new file mode 100644 index 0000000..4085abc --- /dev/null +++ b/problems/bs/inits/24.init @@ -0,0 +1 @@ +817688420639124 diff --git a/problems/bs/inits/3.init b/problems/bs/inits/3.init new file mode 100644 index 0000000..c17e934 --- /dev/null +++ b/problems/bs/inits/3.init @@ -0,0 +1 @@ +97 diff --git a/problems/bs/inits/4.init b/problems/bs/inits/4.init new file mode 100644 index 0000000..c1724de --- /dev/null +++ b/problems/bs/inits/4.init @@ -0,0 +1 @@ +991 diff --git a/problems/bs/inits/5.init b/problems/bs/inits/5.init new file mode 100644 index 0000000..717576b --- /dev/null +++ b/problems/bs/inits/5.init @@ -0,0 +1 @@ +726745 diff --git a/problems/bs/inits/6.init b/problems/bs/inits/6.init new file mode 100644 index 0000000..164e593 --- /dev/null +++ b/problems/bs/inits/6.init @@ -0,0 +1 @@ +769820 diff --git a/problems/bs/inits/7.init b/problems/bs/inits/7.init new file mode 100644 index 0000000..46fc9a2 --- /dev/null +++ b/problems/bs/inits/7.init @@ -0,0 +1 @@ +39242 diff --git a/problems/bs/inits/8.init b/problems/bs/inits/8.init new file mode 100644 index 0000000..ab5ff2b --- /dev/null +++ b/problems/bs/inits/8.init @@ -0,0 +1 @@ +558287 diff --git a/problems/bs/inits/9.init b/problems/bs/inits/9.init new file mode 100644 index 0000000..d21dc6d --- /dev/null +++ b/problems/bs/inits/9.init @@ -0,0 +1 @@ +874697 diff --git a/problems/bs/inits/a.php b/problems/bs/inits/a.php new file mode 100644 index 0000000..3183e5d --- /dev/null +++ b/problems/bs/inits/a.php @@ -0,0 +1,8 @@ + diff --git a/problems/bs/inits/x b/problems/bs/inits/x new file mode 100644 index 0000000..9619be5 --- /dev/null +++ b/problems/bs/inits/x @@ -0,0 +1,25 @@ +218 +280 +40 +97 +991 +726745 +769820 +39242 +558287 +874697 +835997987 +395233934 +403475449 +479944972 +15952939 +681270219720 +367209446112 +978266150219 +82343693519 +27189505666 +32143969796887 +547740858706792 +7973866115106 +428224552539201 +817688420639124 diff --git a/problems/bs/inputs/0.in b/problems/bs/inputs/0.in new file mode 100644 index 0000000..83b33d2 --- /dev/null +++ b/problems/bs/inputs/0.in @@ -0,0 +1 @@ +1000 diff --git a/problems/bs/inputs/1.in b/problems/bs/inputs/1.in new file mode 100644 index 0000000..83b33d2 --- /dev/null +++ b/problems/bs/inputs/1.in @@ -0,0 +1 @@ +1000 diff --git a/problems/bs/inputs/10.in b/problems/bs/inputs/10.in new file mode 100644 index 0000000..770fdcf --- /dev/null +++ b/problems/bs/inputs/10.in @@ -0,0 +1 @@ +1000000000 diff --git a/problems/bs/inputs/11.in b/problems/bs/inputs/11.in new file mode 100644 index 0000000..770fdcf --- /dev/null +++ b/problems/bs/inputs/11.in @@ -0,0 +1 @@ +1000000000 diff --git a/problems/bs/inputs/12.in b/problems/bs/inputs/12.in new file mode 100644 index 0000000..770fdcf --- /dev/null +++ b/problems/bs/inputs/12.in @@ -0,0 +1 @@ +1000000000 diff --git a/problems/bs/inputs/13.in b/problems/bs/inputs/13.in new file mode 100644 index 0000000..770fdcf --- /dev/null +++ b/problems/bs/inputs/13.in @@ -0,0 +1 @@ +1000000000 diff --git a/problems/bs/inputs/14.in b/problems/bs/inputs/14.in new file mode 100644 index 0000000..770fdcf --- /dev/null +++ b/problems/bs/inputs/14.in @@ -0,0 +1 @@ +1000000000 diff --git a/problems/bs/inputs/15.in b/problems/bs/inputs/15.in new file mode 100644 index 0000000..d6ee901 --- /dev/null +++ b/problems/bs/inputs/15.in @@ -0,0 +1 @@ +1000000000000 diff --git a/problems/bs/inputs/16.in b/problems/bs/inputs/16.in new file mode 100644 index 0000000..d6ee901 --- /dev/null +++ b/problems/bs/inputs/16.in @@ -0,0 +1 @@ +1000000000000 diff --git a/problems/bs/inputs/17.in b/problems/bs/inputs/17.in new file mode 100644 index 0000000..d6ee901 --- /dev/null +++ b/problems/bs/inputs/17.in @@ -0,0 +1 @@ +1000000000000 diff --git a/problems/bs/inputs/18.in b/problems/bs/inputs/18.in new file mode 100644 index 0000000..d6ee901 --- /dev/null +++ b/problems/bs/inputs/18.in @@ -0,0 +1 @@ +1000000000000 diff --git a/problems/bs/inputs/19.in b/problems/bs/inputs/19.in new file mode 100644 index 0000000..d6ee901 --- /dev/null +++ b/problems/bs/inputs/19.in @@ -0,0 +1 @@ +1000000000000 diff --git a/problems/bs/inputs/2.in b/problems/bs/inputs/2.in new file mode 100644 index 0000000..83b33d2 --- /dev/null +++ b/problems/bs/inputs/2.in @@ -0,0 +1 @@ +1000 diff --git a/problems/bs/inputs/20.in b/problems/bs/inputs/20.in new file mode 100644 index 0000000..e19179d --- /dev/null +++ b/problems/bs/inputs/20.in @@ -0,0 +1 @@ +1000000000000000 diff --git a/problems/bs/inputs/21.in b/problems/bs/inputs/21.in new file mode 100644 index 0000000..e19179d --- /dev/null +++ b/problems/bs/inputs/21.in @@ -0,0 +1 @@ +1000000000000000 diff --git a/problems/bs/inputs/22.in b/problems/bs/inputs/22.in new file mode 100644 index 0000000..e19179d --- /dev/null +++ b/problems/bs/inputs/22.in @@ -0,0 +1 @@ +1000000000000000 diff --git a/problems/bs/inputs/23.in b/problems/bs/inputs/23.in new file mode 100644 index 0000000..e19179d --- /dev/null +++ b/problems/bs/inputs/23.in @@ -0,0 +1 @@ +1000000000000000 diff --git a/problems/bs/inputs/24.in b/problems/bs/inputs/24.in new file mode 100644 index 0000000..e19179d --- /dev/null +++ b/problems/bs/inputs/24.in @@ -0,0 +1 @@ +1000000000000000 diff --git a/problems/bs/inputs/3.in b/problems/bs/inputs/3.in new file mode 100644 index 0000000..83b33d2 --- /dev/null +++ b/problems/bs/inputs/3.in @@ -0,0 +1 @@ +1000 diff --git a/problems/bs/inputs/4.in b/problems/bs/inputs/4.in new file mode 100644 index 0000000..83b33d2 --- /dev/null +++ b/problems/bs/inputs/4.in @@ -0,0 +1 @@ +1000 diff --git a/problems/bs/inputs/5.in b/problems/bs/inputs/5.in new file mode 100644 index 0000000..749fce6 --- /dev/null +++ b/problems/bs/inputs/5.in @@ -0,0 +1 @@ +1000000 diff --git a/problems/bs/inputs/6.in b/problems/bs/inputs/6.in new file mode 100644 index 0000000..749fce6 --- /dev/null +++ b/problems/bs/inputs/6.in @@ -0,0 +1 @@ +1000000 diff --git a/problems/bs/inputs/7.in b/problems/bs/inputs/7.in new file mode 100644 index 0000000..749fce6 --- /dev/null +++ b/problems/bs/inputs/7.in @@ -0,0 +1 @@ +1000000 diff --git a/problems/bs/inputs/8.in b/problems/bs/inputs/8.in new file mode 100644 index 0000000..749fce6 --- /dev/null +++ b/problems/bs/inputs/8.in @@ -0,0 +1 @@ +1000000 diff --git a/problems/bs/inputs/9.in b/problems/bs/inputs/9.in new file mode 100644 index 0000000..749fce6 --- /dev/null +++ b/problems/bs/inputs/9.in @@ -0,0 +1 @@ +1000000 diff --git a/problems/bs/tester b/problems/bs/tester new file mode 100755 index 0000000..812cf3b Binary files /dev/null and b/problems/bs/tester differ diff --git a/problems/bs/tester.cpp b/problems/bs/tester.cpp new file mode 100644 index 0000000..1ae5699 --- /dev/null +++ b/problems/bs/tester.cpp @@ -0,0 +1,28 @@ +#include +#include +using namespace std; + +int main (int argc, char *argv[]) +{ + ifstream fin(argv[1]); + long long n, tmp; + fin >> n; + + for (int i = 0; i < 74; i++) + { + cin >> tmp; + if (tmp == n) + { + cout << "correct" << endl; + cerr << 100 << endl; + return 0; + } + else if (tmp > n) + cout << "high" << endl; + else + cout << "low" << endl; + } + + cerr << 0 << endl; + return 0; +} diff --git a/problems/hellow/config b/problems/hellow/config new file mode 100644 index 0000000..5e78526 --- /dev/null +++ b/problems/hellow/config @@ -0,0 +1,3 @@ +2 +default +normal 1 16384 %n.in diff --git a/problems/hellow/hellow.cpp b/problems/hellow/hellow.cpp new file mode 100644 index 0000000..f1255ce --- /dev/null +++ b/problems/hellow/hellow.cpp @@ -0,0 +1,12 @@ +#include + +using namespace std; + +int main() +{ + int n; + cin >> n; + cout << 3 * n << endl; + return 0; +} + diff --git a/problems/hellow/inits/0.init b/problems/hellow/inits/0.init new file mode 100644 index 0000000..697cb3a --- /dev/null +++ b/problems/hellow/inits/0.init @@ -0,0 +1 @@ +300 diff --git a/problems/hellow/inits/1.init b/problems/hellow/inits/1.init new file mode 100644 index 0000000..a83d1d5 --- /dev/null +++ b/problems/hellow/inits/1.init @@ -0,0 +1 @@ +-3 diff --git a/problems/hellow/inputs/0.in b/problems/hellow/inputs/0.in new file mode 100644 index 0000000..29d6383 --- /dev/null +++ b/problems/hellow/inputs/0.in @@ -0,0 +1 @@ +100 diff --git a/problems/hellow/inputs/1.in b/problems/hellow/inputs/1.in new file mode 100644 index 0000000..3a2e3f4 --- /dev/null +++ b/problems/hellow/inputs/1.in @@ -0,0 +1 @@ +-1 diff --git a/problems/hellow/tester b/problems/hellow/tester new file mode 100755 index 0000000..a61e8c9 Binary files /dev/null and b/problems/hellow/tester differ diff --git a/problems/hellow/tester.cpp b/problems/hellow/tester.cpp new file mode 100644 index 0000000..f20ffdc --- /dev/null +++ b/problems/hellow/tester.cpp @@ -0,0 +1,23 @@ +#include +#include +#include +#include + +using namespace std; + +int main(int argc, char* argv[]) +{ + ifstream fin (argv[1]); + int z, y; + fin >> z; + cin >> y; + if(z == y) + { +// cerr << "Correct!" << endl; + cerr << 100 << endl; + return 0; + } +// cerr << "Wrong!" << endl; + cerr << 0 << endl; + return 0; +} diff --git a/utils/bs-tester.sh b/utils/bs-tester.sh new file mode 100755 index 0000000..1c21841 --- /dev/null +++ b/utils/bs-tester.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# +# tester.sh - tests whether or not the judge is working properly without web +# Copyright (C) 2012 Hamed Saleh and Mahrud Sayrafi + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +echo -1 \ + admin \ + bs \ + cpp \ + $JUDGE_PREFIX/problems/bs/bs.cpp \ + 0 | #FIXME: what was this?! guess smt like whether or not break on wrong + nc -vv 127.0.0.1 31415 + +sleep 2 # Ladies and gentlemen, please wait for the jury to make its decision! + +tail -n3 $JUDGE_PREFIX/log/error.log # in case there are some errors, they are here! +tail -n1 $JUDGE_PREFIX/log/grading.log # and there you go! the final decision! diff --git a/utils/daemon.sh b/utils/daemon.sh new file mode 100755 index 0000000..ab1d24f --- /dev/null +++ b/utils/daemon.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +LOCK=$JUDGE_PREFIX/judge.pid #FIXME + +if [ -e $LOCK ] +then + PID=`cat $LOCK` + + if ps $PID >/dev/null + then + echo "Daemon is already running and it's PID is $PID." >&2 + exit 1 + else + rm -f $LOCK + fi +fi + +sh $JUDGE_PREFIX/base/daemon.sh &>> $JUDGE_PREFIX/log/error.log & diff --git a/utils/hellow-tester.sh b/utils/hellow-tester.sh new file mode 100755 index 0000000..db39c93 --- /dev/null +++ b/utils/hellow-tester.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# +# tester.sh - tests whether or not the judge is working properly without web +# Copyright (C) 2012 Hamed Saleh and Mahrud Sayrafi + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +echo -1 \ + admin \ + hellow \ + cpp \ + $JUDGE_PREFIX/problems/hellow/hellow.cpp \ + 0 | #FIXME: what was this?! guess smt like whether or not break on wrong + nc -vv 127.0.0.1 31415 + +sleep 2 # Ladies and gentlemen, please wait for the jury to make its decision! + +tail -n3 $JUDGE_PREFIX/log/error.log # in case there are some errors, they are here! +tail -n1 $JUDGE_PREFIX/log/grading.log # and there you go! the final decision! diff --git a/utils/jfsck.sh b/utils/jfsck.sh new file mode 100755 index 0000000..3e53a56 --- /dev/null +++ b/utils/jfsck.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +exec 2>/dev/null + +kill `cat $JUDGE_PREFIX/judge.pid` +sleep 1 +kill -s 9 `cat /var/run/judgeinit.lock0` +kill -s 9 `cat $JUDGE_PREFIX/judge.pid` + +echo hasta la vista, baby! :-t diff --git a/utils/setenv.sh b/utils/setenv.sh new file mode 100755 index 0000000..aa6865f --- /dev/null +++ b/utils/setenv.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +JUDGE_PREFIX=~/hellijudge-legacy + +echo JUDGE_PREFIX=$JUDGE_PREFIX >> ~/.bash_profile -- cgit