using System; using System.Collections.Generic; using System.Linq; class Program { static string ReadLine() { return Console.ReadLine(); } static int ReadInt() { return int.Parse(ReadLine()); } static int[] ReadInts() { return ReadLine().Split().Select(int.Parse).ToArray(); } static string[] ReadStrings() { return ReadLine().Split(); } static void Output(int[] ar, List es) { for (int i = 0; i < ar.Length; i++) { int p = es.IndexOf(ar[i]); if (p == -1) { Console.Write("x"); } else { Console.Write("o"); es.RemoveAt(p); } } Console.WriteLine(); } static void Calc(long x, int[] ar) { var xs = ar.Select(e => (long)e).ToList(); xs.Sort(); var ys = new List(); for (int i = 0; i < 20; i++) { if (xs.Count == 0) break; ys.Add(xs[xs.Count-1]); xs.RemoveAt(xs.Count-1); } long sum = xs.Sum(); var dp = new bool[xs.Count, sum + 1]; if (xs.Count > 0) dp[0, xs[0]] = true; for (int i = 1; i < xs.Count; i++) { for (long j = sum - xs[i]; j > 0; j--) { if (dp[i-1, j]) { dp[i, j] = true; dp[i, j + xs[i]] = true; } } } var es = new List(ys); // ys の選択要素 for (int i = 0; i < (1 << ys.Count); i++) { int p = 0; long t = 0; for (int j = 0; j < ys.Count; j++) { if ((i & (1 << j)) > 0) { t += ys[j]; es[p++] = ys[j]; if (t > x) break; } } if (t == x) { Output(ar, es.GetRange(0, p)); return; } else if (t < x) { if (xs.Count > 0 && x - t < dp.GetLength(1) && dp[xs.Count-1, x - t]) { var es2 = es.GetRange(0, p); long rest = x - t; for (int j = xs.Count-1; j > 0; j--) { if (rest == 0) break; if (j == 0) { if (rest != xs[0]) throw new Exception(); es2.Add(rest); } else if (!dp[j-1, rest]) { es2.Add(xs[j]); rest -= xs[j]; } } Output(ar, es2); return; } } } Console.WriteLine("No"); } static void Main() { var ss = ReadStrings(); long x = long.Parse(ss[1]); var xs = ReadInts(); Calc(x, xs); } }