def zent(x,s) return if($f == 1) return if(s > $s) return if(x >= $n) if(s == $s) $f = 1; return; end return if($memo[s] < x) zent(x+1,s) $memo[s] = x if $memo[s] > x s += $a[x] zent(x+1,s) $memo[s] = x if $memo[s] > x end $f = 0 $n=gets.chomp.to_i $a=gets.chomp.split(" ").map(&:to_i) $s = $a.inject(:+) if ($s%2 == 1) puts "impossible" exit end $s = $s/2 $memo = Array.new($s*2) $memo.fill(9990) zent(0,0) puts ($f == 1)? "possible" :"impossible"