judge_system 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/compile_systems/c_system.rb +8 -11
- data/lib/compile_systems/cpp_system.rb +8 -11
- data/lib/compile_systems/go_system.rb +8 -11
- data/lib/compile_systems/py_system.rb +8 -11
- data/lib/compile_systems/rb_system.rb +9 -12
- data/lib/judge_system.rb +4 -4
- data/lib/judge_system/version.rb +1 -1
- data/lib/zlib_input.rb +3 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d7878d9efa11bd7fc902932df7fb932587ceda8
|
4
|
+
data.tar.gz: a9696f14c64f5b74f6673ab29183628491985444
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfb7c10b4300eada0a3ffa52fe0a18246c43855301b438c3090cf998ea6264171427eabf85f8d5899baac5067ce6130569906328c4a02c1154f95876ea40c3ea
|
7
|
+
data.tar.gz: 18d7353940e3a9523a0c679754292d83f8bd8864d9a98ae26e97c1b27e0da2feebc15d6425e41e7667b0021de612b3b1908b56d2dc48b1ef3b94fc477e3f090e
|
@@ -1,22 +1,19 @@
|
|
1
1
|
require 'zlib'
|
2
|
+
require 'base64'
|
3
|
+
stdin = Zlib::Inflate.new(Zlib::MAX_WBITS + 32).inflate(Base64.decode64($stdin.read)).split("<$><*><$>\n")
|
4
|
+
code = stdin[0]
|
5
|
+
input = stdin[1]
|
6
|
+
time = stdin[2]
|
2
7
|
|
3
8
|
File.open("./main.c", "w") do |file|
|
4
|
-
|
5
|
-
str = gets.chomp.to_s
|
6
|
-
break if str == "<$><*><$>"
|
7
|
-
file.puts str
|
8
|
-
}
|
9
|
+
file.puts code
|
9
10
|
file.close
|
10
11
|
end
|
11
12
|
|
12
13
|
File.open("./test.in", "w") do |file|
|
13
|
-
|
14
|
-
str = gets.chomp.to_s
|
15
|
-
break if str == "<$><*><$>"
|
16
|
-
file.puts Zlib::Inflate.inflate(str)
|
17
|
-
}
|
14
|
+
file.puts input
|
18
15
|
file.close
|
19
16
|
end
|
20
|
-
|
17
|
+
|
21
18
|
system "/opt/wandbox/gcc-head/bin/gcc main.c -o main -O2"
|
22
19
|
system "timeout -s 9 " + time + " ./main < test.in"
|
@@ -1,22 +1,19 @@
|
|
1
1
|
require 'zlib'
|
2
|
+
require 'base64'
|
3
|
+
stdin = Zlib::Inflate.new(Zlib::MAX_WBITS + 32).inflate(Base64.decode64($stdin.read)).split("<$><*><$>\n")
|
4
|
+
code = stdin[0]
|
5
|
+
input = stdin[1]
|
6
|
+
time = stdin[2]
|
2
7
|
|
3
8
|
File.open("./main.cpp", "w") do |file|
|
4
|
-
|
5
|
-
str = gets.chomp.to_s
|
6
|
-
break if str == "<$><*><$>"
|
7
|
-
file.puts str
|
8
|
-
}
|
9
|
+
file.puts code
|
9
10
|
file.close
|
10
11
|
end
|
11
12
|
|
12
13
|
File.open("./test.in", "w") do |file|
|
13
|
-
|
14
|
-
str = gets.chomp.to_s
|
15
|
-
break if str == "<$><*><$>"
|
16
|
-
file.puts Zlib::Inflate.inflate(str)
|
17
|
-
}
|
14
|
+
file.puts input
|
18
15
|
file.close
|
19
16
|
end
|
20
|
-
|
17
|
+
|
21
18
|
system "/opt/wandbox/gcc-head/bin/g++ main.cpp -o main -O2"
|
22
19
|
system "timeout -s 9 " + time + " ./main < test.in"
|
@@ -1,21 +1,18 @@
|
|
1
1
|
require 'zlib'
|
2
|
+
require 'base64'
|
3
|
+
stdin = Zlib::Inflate.new(Zlib::MAX_WBITS + 32).inflate(Base64.decode64($stdin.read)).split("<$><*><$>\n")
|
4
|
+
code = stdin[0]
|
5
|
+
input = stdin[1]
|
6
|
+
time = stdin[2]
|
2
7
|
|
3
8
|
File.open("./main.go", "w") do |file|
|
4
|
-
|
5
|
-
str = gets.chomp.to_s
|
6
|
-
break if str == "<$><*><$>"
|
7
|
-
file.puts str
|
8
|
-
}
|
9
|
+
file.puts code
|
9
10
|
file.close
|
10
11
|
end
|
11
12
|
|
12
13
|
File.open("./test.in", "w") do |file|
|
13
|
-
|
14
|
-
str = gets.chomp.to_s
|
15
|
-
break if str == "<$><*><$>"
|
16
|
-
file.puts Zlib::Inflate.inflate(str)
|
17
|
-
}
|
14
|
+
file.puts input
|
18
15
|
file.close
|
19
16
|
end
|
20
|
-
|
17
|
+
|
21
18
|
system "timeout -s 9 " + time + " /opt/wandbox/go-head/bin/go run main.go < test.in"
|
@@ -1,21 +1,18 @@
|
|
1
1
|
require 'zlib'
|
2
|
+
require 'base64'
|
3
|
+
stdin = Zlib::Inflate.new(Zlib::MAX_WBITS + 32).inflate(Base64.decode64($stdin.read)).split("<$><*><$>\n")
|
4
|
+
code = stdin[0]
|
5
|
+
input = stdin[1]
|
6
|
+
time = stdin[2]
|
2
7
|
|
3
8
|
File.open("./main.py", "w") do |file|
|
4
|
-
|
5
|
-
str = gets.chomp.to_s
|
6
|
-
break if str == "<$><*><$>"
|
7
|
-
file.puts str
|
8
|
-
}
|
9
|
+
file.puts code
|
9
10
|
file.close
|
10
11
|
end
|
11
12
|
|
12
13
|
File.open("./test.in", "w") do |file|
|
13
|
-
|
14
|
-
str = gets.chomp.to_s
|
15
|
-
break if str == "<$><*><$>"
|
16
|
-
file.puts Zlib::Inflate.inflate(str)
|
17
|
-
}
|
14
|
+
file.puts input
|
18
15
|
file.close
|
19
16
|
end
|
20
|
-
|
17
|
+
|
21
18
|
system "timeout -s 9 " + time + " /opt/wandbox/cpython-head/bin/python3 main.py < test.in"
|
@@ -1,21 +1,18 @@
|
|
1
1
|
require 'zlib'
|
2
|
+
require 'base64'
|
3
|
+
stdin = Zlib::Inflate.new(Zlib::MAX_WBITS + 32).inflate(Base64.decode64($stdin.read)).split("<$><*><$>\n")
|
4
|
+
code = stdin[0]
|
5
|
+
input = stdin[1]
|
6
|
+
time = stdin[2]
|
2
7
|
|
3
8
|
File.open("./main.rb", "w") do |file|
|
4
|
-
|
5
|
-
str = gets.chomp.to_s
|
6
|
-
break if str == "<$><*><$>"
|
7
|
-
file.puts str
|
8
|
-
}
|
9
|
+
file.puts code
|
9
10
|
file.close
|
10
11
|
end
|
11
12
|
|
12
13
|
File.open("./test.in", "w") do |file|
|
13
|
-
|
14
|
-
str = gets.chomp.to_s
|
15
|
-
break if str == "<$><*><$>"
|
16
|
-
file.puts Zlib::Inflate.inflate(str)
|
17
|
-
}
|
14
|
+
file.puts input
|
18
15
|
file.close
|
19
16
|
end
|
20
|
-
|
21
|
-
system "timeout -s 9 " + time + " /opt/wandbox/ruby-head/bin/ruby main.rb < test.in"
|
17
|
+
|
18
|
+
system "timeout -s 9 " + time + " /opt/wandbox/ruby-head/bin/ruby main.rb < test.in"
|
data/lib/judge_system.rb
CHANGED
@@ -5,6 +5,7 @@ require "uri"
|
|
5
5
|
require "json"
|
6
6
|
require 'timeout'
|
7
7
|
require 'pathname'
|
8
|
+
|
8
9
|
module JudgeSystem
|
9
10
|
class WandBox
|
10
11
|
|
@@ -28,13 +29,12 @@ module JudgeSystem
|
|
28
29
|
path = File.expand_path('../', __FILE__ )
|
29
30
|
sys = File.open("#{path}/compile_systems/#{lang}_system.rb", "r").read
|
30
31
|
data = nil
|
31
|
-
spliter = "
|
32
|
-
|
33
|
-
stdin = code + spliter + input + spliter + ("%f" % time)
|
32
|
+
spliter = "<$><*><$>\n"
|
33
|
+
stdin = ZlibInput.zlib(code + spliter + input + spliter + ("%f" % time))
|
34
34
|
begin
|
35
35
|
data = compile( compiler: "ruby-head", code: sys, stdin: stdin )
|
36
36
|
rescue
|
37
|
-
return
|
37
|
+
return 'RE'
|
38
38
|
end
|
39
39
|
error = data["program_error"]
|
40
40
|
result = data["program_output"]
|
data/lib/judge_system/version.rb
CHANGED
data/lib/zlib_input.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: judge_system
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- getty104
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|