func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename T>   inline T sqr(const T& a) {     return a * a;   }   template <typename T>   inline int sign(const T& a) {     return a < 0 ? -1 : a > 0;   }   void task();   int main() {     task();     return 0;   }   char dp[21][1 << 5][161050 + 10];   char par[21][1 << 5][161050 + 10];   int n, m;   int an[6], am[21];   vector<int> mask_by_cnt[6];   vector<int> to_11[161050 + 10];   int pw[11];   inline int to_number(vector<int>& v) {     return v[0] + v[1] * 11 + v[2] * 11 * 11 + v[3] * 11 * 11 * 11 +            v[4] * 11 * 11 * 11 * 11;   }   void task() {     ios_base::sync_with_stdio(0);     cin >> n >> m;     for (int i = 0; i < n; ++i) cin >> an[i];     for (int i = 0; i < m; ++i) cin >> am[i];     pw[0] = 1;     for (int i = 1; i < 11; ++i) pw[i] = pw[i - 1] * 11;     for (int mask = 0; mask < (1 << n); ++mask) {       vector<int> v;       for (int j = 0; j < n; ++j) v.push_back((mask & (1 << j)) > 0);       v.push_back(17);       int cnt = 0;       for (int i = v.size() - 2; i >= 0; --i)         cnt += v[i] == 1 && v[i] != v[i + 1];       mask_by_cnt[cnt].push_back(mask);     }     for (int a = 0; a <= 10; ++a)       for (int b = 0; b <= 10; ++b)         for (int c = 0; c <= 10; ++c)           for (int d = 0; d <= 10; ++d)             for (int e = 0; e <= 10; ++e) {               int number = e + d * 11 + c * 11 * 11 + b * 11 * 11 * 11 +                            a * 11 * 11 * 11 * 11;               to_11[number] = {e, d, c, b, a};             }     int limit_number = 1;     for (int i = 0; i < n; ++i) limit_number *= 11;     dp[0][0][0] = 1;     par[0][0][0] = -1;     for (int i = 0; i < m; ++i)       for (int prev_mask : mask_by_cnt[i - 1 >= 0 ? am[i - 1] : 0])         for (int number = 0; number < limit_number; ++number)           if (dp[i][prev_mask][number])             for (int cur_mask : mask_by_cnt[am[i]]) {               int nb = number;               int ok = 1;               for (int j = 0; j < n; ++j)                 if ((prev_mask & (1 << j)) == 0 && (cur_mask & (1 << j)) > 0) {                   nb += pw[j];                   if (to_11[number][j] == an[j]) {                     ok = 0;                     break;                   }                 }               dp[i + 1][cur_mask][nb] = 1;               par[i + 1][cur_mask][nb] = prev_mask;             }     vector<int> v = {an[0], an[1], an[2], an[3], an[4]};     int number = to_number(v);     for (int mask = 0; mask < (1 << n); ++mask) {       if (dp[m][mask][number]) {         (void(1));         ;         vector<string> ans(n, string(m, 0));         int cur_mask = mask;         for (int i = m; i > 0; --i) {           for (int j = 0; j < n; ++j)             ans[j][i - 1] = (cur_mask & (1 << j)) > 0 ?  *  :  . ;           int prev_mask = par[i][cur_mask][number];           for (int j = 0; j < n; ++j)             if ((prev_mask & (1 << j)) == 0 && (cur_mask & (1 << j)) > 0) {               number -= pw[j];             }           cur_mask = prev_mask;         }         for (int i = 0; i < n; ++i) cout << ans[i] <<   n ;         return;       }     }     (void(1));     ;   }   