fork(1) download
  1. t = gets.chomp.to_i
  2.  
  3. t.times do |test|
  4. n,x = gets.chomp.split(" ").map(&:to_i)
  5. a = gets.chomp.split(" ").map(&:to_i)
  6. loops = a.collect{|a| (a/x).ceil}
  7. positions = {}
  8. loops.each.with_index{|val,i| positions[val] = (positions[val] || []) << i+1}
  9. exit_array = positions.keys.sort.collect do |exit_loop|
  10. positions[exit_loop]
  11. end.flatten
  12. puts "Case ##{test+1}: #{exit_array.join(" ")}"
  13. end
Success #stdin #stdout 0s 6516KB
stdin
1
1 1
1
stdout
Case #1: 1