#include "bits/stdc++.h" using namespace std; #define REP(i, n) for(int i=0; i<(n); i++) int N; //int maxhp(vector D, int hp, int ceilhp) { // if (D.empty()) return hp; // int mh = 0; // REP(i,D.size()) { // int h = min(hp + D[i], ceilhp); // if (h <= 0) continue; // 死亡 // vector tmp; // for (int j : D) tmp.push_back(j); // tmp.erase(tmp.begin() + i); // mh = max(mh, maxhp(tmp, h, ceilhp + ((D[i]<0)?100:0))); // } // return mh; //} vector D(16); int ceilhp(int n) { int ret = 100; REP(i,N) { if (n & 1<> N; REP(i,N) cin >> D[i]; int dp[(1<<16)*2] = {0}; dp[0] = 100; REP(i,1< bs = bitset<16>(i); int maxhp = dp[i]; REP(j,16) { if (bs[j] == 0) continue; int k= i - (1<