Description:
MERGED change set (408:410) from web/judge in branch combined-with-judge (fixed time_limit option bug)
git-svn-id: http://theory.cpe.ku.ac.th/grader/judge/trunk/scripts@411 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r73:34ddb0155d6f - - 1 file changed: 1 inserted, 1 deleted
@@ -16,49 +16,49 | |||
|
16 | 16 | } |
|
17 | 17 | } |
|
18 | 18 | |
|
19 | 19 | def input_filename(dir,i) |
|
20 | 20 | "#{dir}/input-#{i}.txt" |
|
21 | 21 | end |
|
22 | 22 | |
|
23 | 23 | def answer_filename(dir,i) |
|
24 | 24 | "#{dir}/answer-#{i}.txt" |
|
25 | 25 | end |
|
26 | 26 | |
|
27 | 27 | def build_testrun_info_from_dir(num_testruns, importing_test_dir, raw_prefix='') |
|
28 | 28 | filenames = Dir["#{importing_test_dir}/#{raw_prefix}*.in"].collect do |filename| |
|
29 | 29 | File.basename((/(.*)\.in/.match(filename))[1]) |
|
30 | 30 | end |
|
31 | 31 | build_testrun_info(num_testruns,filenames,raw_prefix) |
|
32 | 32 | end |
|
33 | 33 | |
|
34 | 34 | def copy_testcase(importing_test_dir,fname,dir,i) |
|
35 | 35 | system("cp #{importing_test_dir}/#{fname}.in #{input_filename(dir,i)}") |
|
36 | 36 | system("cp #{importing_test_dir}/#{fname}.sol #{answer_filename(dir,i)}") |
|
37 | 37 | end |
|
38 | 38 | |
|
39 | 39 | def process_options(options) |
|
40 |
- i = |
|
|
40 | + i = 3 | |
|
41 | 41 | while i<ARGV.length |
|
42 | 42 | if ARGV[i]=='-t' |
|
43 | 43 | options[:time_limit] = ARGV[i+1].to_f if ARGV.length>i+1 |
|
44 | 44 | i += 1 |
|
45 | 45 | end |
|
46 | 46 | if ARGV[i]=='-m' |
|
47 | 47 | options[:mem_limit] = ARGV[i+1].to_i if ARGV.length>i+1 |
|
48 | 48 | i += 1 |
|
49 | 49 | end |
|
50 | 50 | i += 1 |
|
51 | 51 | end |
|
52 | 52 | end |
|
53 | 53 | |
|
54 | 54 | def print_usage |
|
55 | 55 | puts "using: import_problem_new name dir check [options] |
|
56 | 56 | |
|
57 | 57 | where: name = problem_name (put '-' (dash) to use dir name) |
|
58 | 58 | dir = importing testcase directory |
|
59 | 59 | check = check script, which can be |
|
60 | 60 | 'integer', 'text' (for standard script), |
|
61 | 61 | path_to_your_script, or |
|
62 | 62 | 'wrapper:(path_to_your_wrapped_script)' |
|
63 | 63 | options: -t time-limit (in seconds) |
|
64 | 64 | -m memory-limit (in megabytes) |
You need to be logged in to leave comments.
Login now