#include #define show(x) cerr << #x << " = " << x << endl using namespace std; using ll = long long; using pii = pair; using vi = vector; template ostream& operator<<(ostream& os, const vector& v) { os << "sz=" << v.size() << "\n["; for (const auto& p : v) { os << p << ","; } os << "]\n"; return os; } template ostream& operator<<(ostream& os, const pair& p) { os << "(" << p.first << "," << p.second << ")"; return os; } constexpr ll MOD = 1e9 + 7; template constexpr T INF = numeric_limits::max() / 100; int main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; ll X; cin >> X; constexpr ll LEVEL = 100000; using P = pair; vector

lower; vector

upper; ll lower_sum = 0; for (int i = 0; i < N; i++) { ll v; cin >> v; lower_sum += ((v >= LEVEL) ? 0 : v); ((v >= LEVEL) ? upper : lower).push_back(make_pair(v, i)); } const int upper_size = upper.size(); const int maximum = 1 << upper_size; vector upper_sum(maximum, 0); for (int i = 0; i < maximum; i++) { for (int j = 0; j < upper_size; j++) { if (i & (1 << j)) { upper_sum[i] += upper[j].first; } } } const int lower_size = lower.size(); vector> dp(lower_size + 1, vector(lower_sum + 1, -2)); dp[0][0] = -1; for (int i = 0; i < lower_size; i++) { for (int j = 0; j <= lower_sum; j++) { if (dp[i][j] != -2) { dp[i + 1][j] = -1; dp[i + 1][j + lower[i].first] = i; } } } for (int i = 0; i < maximum; i++) { if (X < upper_sum[i]) { break; } ll rest = X - upper_sum[i]; if (rest > lower_sum) { continue; } if (dp[lower_size][rest] != -2) { vector use(N, false); for (int j = 0; j < upper_size; j++) { if (i & (1 << j)) { use[upper[j].second] = true; } } for (int j = lower_size; j >= 1; j--) { if (dp[j][rest] != -1) { use[lower[dp[j][rest]].second] = true; rest -= lower[dp[j][rest]].first; } } for (int j = 0; j < N; j++) { cout << (use[j] ? 'o' : 'x'); } cout << "\n"; return 0; } } cout << "No" << endl; return 0; }