// yukicoder: No.332 数列をプレゼントに // 2019.7.8 bal4u #include #include typedef long long ll; #if 1 #define gc() getchar_unlocked() #define pc(c) putchar_unlocked(c) #else #define gc() getchar() #define pc(c) putchar(c) #endif ll in() { // 非負整数の入力 ll n = 0; int c = gc(); do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0'); return n; } void outs(char *s) { while (*s) pc(*s++); pc('\n'); } void outc(int f, char c) { while (f--) pc(c); pc('\n'); } #define LIM 100000 typedef struct { int v, id; } T; T a[105], b[105]; int fa, fb; int N; ll X; char f[105]; int dp[80*LIM]; int cmp(const void *a, const void *b) { return ((T *)a)->v - ((T *)b)->v; } void final(int p, int q) { int i; // printf("final: p=%d, q=%x\n", p, q); fflush(stdout); while (p) { // printf("p=%d, prev=%d, id=%d\n", p, dp[p] >> 7, (dp[p] & 127)-1); f[(dp[p] & 127)-1] = 1; p = dp[p] >> 7; } for (i = 0; q; i++) { if (q & 1) f[b[i].id] = 1; q >>= 1; } for (i = 0; i < N; i++) pc(f[i]? 'o': 'x'); pc('\n'); exit(0); } int main() { int i, j, x, ma; ll s; N = (int)in(), X = in(), s = 0, fa = 1, fb = 0; for (i = 0; i < N; i++) { x = (int)in(), s += x; if (x <= LIM) a[++fa].id = i, a[fa].v = x; else b[fb].id = i, b[fb++].v = x; } if (s == X) { outc(N, 'o'); return 0; } if (s < X) { outs("No"); return 0; } qsort(a+2, fa-1, sizeof(T), cmp); qsort(b, fb, sizeof(T), cmp); dp[0] = 1, ma = 0; for (i = 2; i <= fa; i++) { for (j = ma; j >= 0; j--) { if (dp[j] && !dp[j+a[i].v]) dp[j+a[i].v] = (j << 7) | (a[i].id+1); } ma += a[i].v; } // printf("ma=%d, fa=%d, fb=%d, X=%lld, s=%lld\n", ma, fa-1, fb, X, s); if (X <= ma && dp[X]) final(X, 0); i = 1 << fb; while (--i) { s = 0, x = i; for (j = 0; x; j++) { if (x & 1) { s += b[j].v; if (s > X) goto next; } x >>= 1; } if ((s << 1) < X-ma) break; if (X-s <= ma && dp[X-s]) final(X-s, i); next:; } outs("No"); return 0; }