Created
April 14, 2019 04:25
-
-
Save whatalnk/131371c56173b0d23fc636ab0ba1a95c to your computer and use it in GitHub Desktop.
Codeforces #551 Div2 B - Serval and Toy Bricks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n, m, h = gets.chomp.split(" ").map(&:to_i) | |
front = gets.chomp.split(" ").map(&:to_i) | |
left = gets.chomp.split(" ").map(&:to_i) | |
top = [] | |
n.times do | |
top << gets.chomp.split(" ").map(&:to_i) | |
end | |
ret = Array.new(n){Array.new(m, -1)} | |
m.times do |i| | |
n.times do |j| | |
ret[j][i] = front[i] | |
end | |
end | |
n.times do |j| | |
m.times do |i| | |
ret[j][i] = [ret[j][i], left[j]].min | |
end | |
end | |
m.times do |i| | |
n.times do |j| | |
if top[j][i] == 0 | |
ret[j][i] = 0 | |
end | |
end | |
end | |
ret.each{|line| puts line.join(" ")} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment