Created
November 12, 2016 16:25
-
-
Save whatalnk/084df48cfbbc02de64a42a76d0031ea5 to your computer and use it in GitHub Desktop.
AtCoder AGC #007 [Ruby]
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
h, w = gets.chomp.split(" ").map(&:to_i) | |
s = 0 | |
h.times do | |
row = gets.chomp.split("") | |
s += row.count("#") | |
end | |
if s == (h + w - 1) then | |
puts "Possible" | |
else | |
puts "Impossible" | |
end |
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 = gets.chomp.to_i | |
p_ = gets.chomp.split(" ").map(&:to_i) | |
a_ = (1..n).map{|x| x * n} | |
b_ = a_.reverse | |
d = 1 | |
p_.each do |i| | |
a_[i-1] += d | |
d += 1 | |
end | |
puts a_.join(" ") | |
puts b_.join(" ") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment