Submission #1262805


Source Code Expand

def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end
def inpf() a=gets.chomp.split(" ").map(&:to_f)end
def inps() a=gets.chomp.split(" ")end  
def copy(a) Marshal.load(Marshal.dump(a)) end
def kaizyo(n)(n < 2)? 1 : (2..n).inject(:*) end
def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end
def na(n=0,d=0) Array.new(n,d)end
def na2(n=0,m=0,d=0) Array.new(n){Array.new(m,d)}end
def na3(n=0,m=0,l=0,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end
def bit(n) n.to_s(2).split("").map(&:to_i) end
def inp() a=gets.chomp.split(" ").map(&:to_i)end
a=inp
ans = 0
h={}
f = 0
a.each do |d|
  f = 1 if(!(d.even?))
end
ans+=1 if(f == 0)
while(true)
  na = (a[1]+a[2])/2
  nb = (a[0]+a[2])/2
  nc = (a[0]+a[1])/2
  a = [na,nb,nc]
  f = 2 if(h[a] == true)
  h[a] = true 
  a.each do |d|
    f = 1 if(!(d.even?))
  end
  break if(f>0)
  ans += 1
end
p (f==1)? ans : -1
=begin
=end

Submission Info

Submission Time
Task A - Cookie Exchanges
User zazaboon
Language Ruby (2.3.3)
Score 300
Code Size 921 Byte
Status AC
Exec Time 7 ms
Memory 1788 KB

Compile Error

./Main.rb:2: warning: assigned but unused variable - a
./Main.rb:3: warning: assigned but unused variable - a
./Main.rb:11: warning: assigned but unused variable - a

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 17
Set Name Test Cases
Sample sample1.txt, sample2.txt, sample3.txt
All sample1.txt, sample2.txt, sample3.txt, in1.txt, in10.txt, in11.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, in9.txt, sample1.txt, sample2.txt, sample3.txt
Case Name Status Exec Time Memory
in1.txt AC 7 ms 1788 KB
in10.txt AC 7 ms 1788 KB
in11.txt AC 7 ms 1788 KB
in2.txt AC 7 ms 1788 KB
in3.txt AC 7 ms 1788 KB
in4.txt AC 7 ms 1788 KB
in5.txt AC 7 ms 1788 KB
in6.txt AC 7 ms 1788 KB
in7.txt AC 7 ms 1788 KB
in8.txt AC 7 ms 1788 KB
in9.txt AC 7 ms 1788 KB
sample1.txt AC 7 ms 1788 KB
sample2.txt AC 7 ms 1788 KB
sample3.txt AC 7 ms 1788 KB