require 'pp' def main n = gets.to_i ws = gets.strip.split(' ').map{|e| e.to_i} sum = ws.reduce(:+) result = solve(ws, 0, sum) puts result ? "possible" : "impossible" end def solve(ws, acc, sum) if (sum % 2 === 1) return false end if (acc * 2 === sum) return true end if (ws.empty?) return false end nex = ws[0] _ws = ws[1..-1] solve(_ws, acc + nex, sum) || solve(_ws, acc, sum) end main()