#include #include #include using namespace std; static const int MAX_N = 100; int main() { int N; cin >> N; vectorw(N); for (int i = 0; i < N; i++) { cin >> w[i]; } int all = 0; for (int i = 0; i < N; i++) { all += w[i]; } int sum = all / 2; if (all % 2 != 0) { cout << "impossible" << endl; return 0; } vector>dp(N, vector(sum+1, false));//i番目まで重りを見て、合計jグラムになるかどうか for (int i = 0; i < N ; i++) { dp[i][0] = true; } for (int i = 0; i <= N - 2; i++) { for (int j =0 ; j+w[i+1] <=sum; j++) { dp[i + 1][j + w[i + 1]] = dp[i][j]; } } if (dp[N - 1][sum]) { cout << "possible" << endl; } else { cout << "impossible" << endl; } return 0; }