func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 100005;   int cnt[maxn], num[maxn], t[maxn], r[maxn], last[maxn];   char ans[maxn];   int main() {     int T, m, k;     scanf( %d , &T);     while (T--) {       scanf( %d%d , &m, &k);       for (int i = 1; i <= k; i++) {         scanf( %d , &num[i]);         ans[i] =  N ;         cnt[i] = 0;         last[i] = 0;       }       int unknown = 0;       bool flag = 0;       for (int i = 1; i <= m - 1; i++) {         scanf( %d%d , &t[i], &r[i]);         last[t[i]] = i;       }       for (int i = 1; i <= m - 1; i++) {         if (r[i] == 0) {           if (t[i])             cnt[t[i]]++;           else             unknown++;         } else {           if (flag == 0) {             int tmp = 0x3fffffff;             for (int j = 1; j <= k; j++) {               if (last[j] < i && cnt[j] + unknown >= num[j]) {                 tmp = min(tmp, num[j] - cnt[j]);                 ans[j] =  Y ;               }             }             unknown -= tmp;             flag = 1;           }           if (t[i])             cnt[t[i]]++;           else             unknown++;         }         if (t[i] != 0 && cnt[t[i]] == num[t[i]]) {           flag = 1;         }       }       for (int i = 1; i <= k; i++) {         if (num[i] - cnt[i] - unknown <= 0) {           ans[i] =  Y ;         }       }       ans[k + 1] = 0;       printf( %s n , ans + 1);     }     return 0;   }   