Last active
February 2, 2018 11:59
-
-
Save whatalnk/c9b684ee986aae1ff528e1ed93960f9f to your computer and use it in GitHub Desktop.
AtCoder ABC #080 C. Shopping Street
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
# ABC080 | |
# C. Shopping Street | |
n = gets.chomp.to_i | |
f_ = [] | |
n.times do | |
f_ << gets.chomp.split(" ").map(&:to_i) | |
end | |
p_ = [] | |
n.times do | |
p_ << gets.chomp.split(" ").map(&:to_i) | |
end | |
profits = [] | |
1.upto((1<<10) - 1) do |b| | |
prft = 0 | |
n.times do |i| | |
# Store | |
c = 0 | |
10.times do |j| | |
# Time | |
if (((b >> j) & 1) & f_[i][j]) == 1 then | |
c += 1 | |
end | |
end | |
prft += p_[i][c] | |
end | |
profits << prft | |
end | |
puts profits.max |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment