#include #include #include #include int N; std::vector W; std::map, bool> mp; bool check(int ind, int t) { std::pair p = std::make_pair(ind, t); if (mp.find(p) != mp.end()) { return mp[p]; } if (t == 0) { mp[p] = true; return true; } else if (t < 0) { mp[p] = false; return false; } for (int i = ind + 1; i < N; i++) { if (check(i, t - W[i])) { mp[p] = true; return true; } } mp[p] = false; return false; } int main() { int sum; int target; std::cin >> N; W.resize(N); for (int i = 0; i < N; i++) { std::cin >> W[i]; } sum = std::accumulate(W.begin(), W.end(), 0); target = sum / 2; if (sum % 2 == 1) { std::cout << "impossible" << std::endl; } else if (check(0, target)) { std::cout << "possible" << std::endl; } else { std::cout << "impossible" << std::endl; } }