Cover Array With Restricted Operations by shinh

a=$<.map &:split
c=0
while x=a[c]
y=a[c+1]
99.times{|n|o=false
0.upto(n){|l|r=n-l
t=y[l,100-r-l]
u=y[0,l]+y[100-r..-1]
j=0
o|=x.all?{|v|v==t[j]?j+=1:(k=u.index(v))&&(u[k]=1)}}
if o
p n
break
end}
c+=2
end

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

To protect the system from spam, please input your favorite sport (hint: I believe its name must start with 'g', case insensitive)

download

return to the top page