N = gets.to_i def query(drinks) STDOUT.puts("? #{drinks.size}") STDOUT.puts(drinks.join(' ')) STDOUT.flush gets.to_i end ans = [] drinks = [*1..N] N.times do |i| temp = drinks[i] drinks.delete_at(i) res = query(drinks) if res == 0 ans << (i + 1) end drinks.insert(i, temp) end puts "! #{ans.size}" puts ans.join(' ')