Created
March 21, 2018 04:25
-
-
Save whatalnk/bd399e4656c86d00aa48511e6bb445c9 to your computer and use it in GitHub Desktop.
COLOCON 2018 B. すぬけそだて――チュートリアル――
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, x = gets.chomp.split(" ").map(&:to_i) | |
s = gets.chomp | |
tt = [] | |
n.times do | |
tt << gets.chomp.to_i | |
end | |
ans = 0 | |
n.times do |i| | |
if s[i] == '0' then | |
ans += tt[i] | |
else | |
ans += [tt[i], x].min | |
end | |
end | |
puts ans |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment