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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a45139d0e2832eccef34a7f8c6d71fa20de7f9a2
4
- data.tar.gz: 7e10badc069a5be4e44fda91bfa880eb0467d8cb
3
+ metadata.gz: 3d7878d9efa11bd7fc902932df7fb932587ceda8
4
+ data.tar.gz: a9696f14c64f5b74f6673ab29183628491985444
5
5
  SHA512:
6
- metadata.gz: 9721286ffcafc49c6fa33019743c541d80f7515dae8012993c10a8a30b2413829b06e2100a4a52bdc586470d9654ef8c87e704d7f50fca1348001d1948e9e66b
7
- data.tar.gz: 29368cebb9d27e02998438d20b62a7ae29524bf5fd41f01feeb01fe62ab8a46f982a1b4cf9f6843db096b29c58856aae4029d1fbe4b712e52852bbc062d899d1
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
- loop{
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
- loop{
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
- time = gets
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
- loop{
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
- loop{
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
- time = gets
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
- loop{
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
- loop{
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
- time = gets
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
- loop{
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
- loop{
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
- time = gets
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
- loop{
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
- loop{
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
- time = gets
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"
@@ -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 = "\n<$><*><$>\n"
32
- input = ZlibInput.zlib(input)
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 "RE"
37
+ return 'RE'
38
38
  end
39
39
  error = data["program_error"]
40
40
  result = data["program_output"]
@@ -1,3 +1,3 @@
1
1
  module JudgeSystem
2
- VERSION = "1.5.0"
2
+ VERSION = "1.5.1"
3
3
  end
@@ -1,8 +1,9 @@
1
1
  require 'zlib'
2
-
2
+ require 'base64'
3
3
  module ZlibInput
4
4
  def zlib input
5
- Zlib::Deflate.deflate(input,Zlib::BEST_SPEED)
5
+ data = Zlib::Deflate.deflate(input)
6
+ Base64.encode64(data)
6
7
  end
7
8
  module_function :zlib
8
9
  end
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.0
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-26 00:00:00.000000000 Z
11
+ date: 2017-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler