#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) #define FOREACH(i, a) for(int i=0;i #define pcc pair #define pic pair #define pci pair #define VS vector #define VI vector #define DEBUG(x) cout<<#x<<": "<> N >> X; vector AO(N); vector AL(N); vector AU(N); REP(i, N) { cin >> AO[i]; if (AO[i] < lim) AL[i] = AO[i]; else AU[i] = AO[i]; } sort(ALL(AL)); int upper = -1; //GetSum of lower & index of upper.begin int sum_lower = 0; FOREACH(i, AL) { sum_lower += AL[i]; } //dp[value] = (prior value); vector dp(sum_lower+1); dp[0] = -1; REP(i, AL.size()) { RFOR(j, 0, sum_lower + 1) { if (j - AL[i] < dp.size()) if (dp[j] == 0 && dp[j - AL[i]] != 0) dp[j] = AL[i]; } } vector ansvalue; for (ull mask = 0; mask < (1 << AU.size()); ++mask) { ull sum = 0; REP(i, AU.size()) if (mask&(1 << i)) sum += AU[i]; int s = X - sum; if (s >= 0 && s < dp.size()) if (dp[s] != 0){ REP(i, AU.size()) if (mask&(1 << i)) ansvalue.push_back(AU[i]); // retrospective while (dp[s] != -1) { ansvalue.push_back(dp[s]); s = s - dp[s]; } break; } } if (ansvalue.size() == 0) cout << "NO" << endl; else { for (auto &a : AO) { auto it = find(ALL(ansvalue), a); if (it != ansvalue.end()) { ansvalue.erase(it); cout << "o"; } else cout << "x"; } cout << endl; } return 0; }