// // main.cpp // Q19 // // Created by AkihiroKOBAYASHI on 7/6/15. // Copyright (c) 2015 Akhr5884. All rights reserved. // #include const int MAX_N = 5000; // n const int MAX_W = 5000; // w int cache[MAX_N + 1][MAX_W + 1]; int *w; int sum; int n; int check; void judge(int nowWeight, int nowNumber) { if(check != 1 && nowNumber < n) { if(cache[nowWeight][nowNumber] == -1) { if(nowWeight == sum-nowWeight) { check = 1; for (int i = 0; i < MAX_N + 1; i++) { for (int j = 0; j < MAX_W + 1; j++) { cache[i][j] = 1; } } return; } else if(nowWeight < sum-nowWeight){ // add judge(nowWeight, nowNumber + 1); // not add judge(nowWeight + w[nowNumber], nowNumber + 1); } } cache[nowWeight][nowNumber] = 0; return; } return; } int main(int argc, const char * argv[]) { // memset(cache, -1, sizeof(cache)); for (int i = 0; i < MAX_N + 1; i++) { for (int j = 0; j < MAX_W + 1; j++) { cache[i][j] = -1; } } std::cin >> n; w = (int*)malloc(sizeof(w) * n); int count = 0; sum = 0; while (count < n) { int wi; std::cin >> wi; w[count] = wi; sum += wi; count++; } check = 0; if(sum%2 == 0) { judge(0, 0); } if(check == 1) { std::cout << "possible" << "\n"; } else { std::cout << "impossible" << "\n"; } return 0; }