-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHelper.rb
More file actions
59 lines (42 loc) · 894 Bytes
/
Helper.rb
File metadata and controls
59 lines (42 loc) · 894 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#MADE BY HAMZA HASBI
require 'colorize'
require 'benchmark'
time=Time.new
Task=Benchmark.realtime do
print "Output file path :"
out_path=gets.chomp.to_s
out_tab=Array.new();
begin
File.foreach(out_path) do |line|
out_tab<<line.chomp
end
rescue Exception =>e
puts e.message
puts "Idlness limit Excedeed!"
end
print "judge's output file path :"
judge_path=gets.chomp.to_s
judge_tab=Array.new();
begin
File.foreach(judge_path) do |line|
judge_tab<<line.chomp
end
rescue Exception =>e
puts e.message
puts "Idlness limit Excedeed!".red
end
good=true;
if judge_tab.length==out_tab.length then
for i in 0...judge_tab.length
if judge_tab[i]!=out_tab[i] then
good=false
break
end
end
else good=false
end
if good==true then puts "YES!".green
else puts "WRONG ANSWER!".red
end
end
puts "#{time.day}/#{time.month}/#{time.year} : Process finished in #{Task} ms".yellow