// No.4 おもりと天秤 #include #include using namespace std; int main() { int N; cin >> N; vector W(N); int s = 0; for (int i = 0; i < N; ++i) cin >> W[i], s += W[i]; if (s % 2) { cout << "impossible" << endl; return 0; } vector> dp(N + 1, vector(s + 1, false)); dp[0][0] = true; for (int i = 0; i < N; ++i) { for (int j = 0; j <= s; ++j) { dp[i + 1][j] = dp[i][j]; if (j - W[i] >= 0) { dp[i + 1][j] = dp[i + 1][j] || dp[i][j - W[i]]; } } } if (dp[N][s / 2]) cout << "possible" << endl; else cout << "impossible" << endl; }