Skip to content

Instantly share code, notes, and snippets.

@whatalnk
Created October 7, 2017 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whatalnk/3ab9d7bea10ca184766f966433bdf2a0 to your computer and use it in GitHub Desktop.
Save whatalnk/3ab9d7bea10ca184766f966433bdf2a0 to your computer and use it in GitHub Desktop.
DDCC 2017 予選
s = gets.chomp
if s[0] == s[1] && s[1] != s[2] && s[2] == s[3]
puts "Yes"
else
puts "No"
end
a, b, c, d = gets.chomp.split(" ").map(&:to_i)
puts a * 1728 + b * 144 + c * 12 + d
n, c = gets.chomp.split(" ").map(&:to_i)
l = []
n.times do |i|
l << [gets.chomp.to_i, i]
end
l.sort_by!{|x| x[0]}
ans = n
l.each do |ll|
x = l.pop
if x[1] == ll[1]
break
elsif ll[0] + x[0] + 1 <= c
ans -= 1
else
redo
end
end
puts ans
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment