#include #include #include #include #include #include #include #include //#include //#include using namespace std; long long MODA = 100000909770901ll; long long MODB = 100000002135407ll; const int MAXN = 200050; inline void print(char pt) { printf("%c\n", pt); } inline void print(int pt) { printf("%d\n", pt); } inline void print(long long pt) { printf("%I64d\n", pt); } inline void print(double pt) { printf("%.20f\n", pt); } inline void print(char pt[]) { printf("%s\n", pt); } inline void print() { printf("\n"); } inline void scan(int &pt) { scanf("%d", &pt); } inline void scan(char &pt) { scanf("%c", &pt); } inline void scan(long long &pt) { scanf("%I64d", &pt); } inline void scan(double &pt) { scanf("%lf", &pt); } inline void scan(char pt[]) { scanf("%s", pt); } struct str { char val[108]; str() { memset(val, 0, sizeof(val)); } friend int operator<(str a, str b) { return strcmp(a.val, b.val) < 0; } }; //int gcd(int x, int y) { // return y ? gcd(y, x % y) : x; //} //int lcm(int x, int y) { // return x * (y / gcd(x, y)); //} long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; } long long lcm(long long x, long long y) { return x * (y / gcd(x, y)); } int bits[50]; void getbits() { for (int i = 0; i < 30; i++) { bits[i] = 1 << i; } } long long Q_pow(long long x, long long y) { long long res = 1; while (y) { if (y % 2 == 1) { res *= x; res %= MODA; } x = x * x; x %= MODA; // if(x<=1e-5){ // return 0; // } y /= 2; } return res; } //返回d=gcd(a,b);和对应于等式ax+by=d中的x,y long long extend_gcd(long long a, long long b, long long &x, long long &y) { if (a == 0 && b == 0) return -1; //无最大公约数 if (b == 0) { x = 1; y = 0; return a; } long long d = extend_gcd(b, a % b, y, x); y -= a / b * x; return d; } //*********求逆元素******************* //ax = 1(mod n) long long mod_reverse(long long a, long long MOD) { long long x, y; long long d = extend_gcd(a, MOD, x, y); if (d == 1) return (x % MOD + MOD) % MOD; else return -1; } //struct point { // long long x, y; // int index; //}; //long long cross(point a1, point a2, point b1, point b2) { // a2.x -= a1.x; // a2.y -= a1.y; // // b2.x -= b1.x; // b2.y -= b1.y; // // return 1ll * a2.x * b2.y - 1ll * b2.x * a2.y; //} // //point C; //int point_cmp(point a, point b) { ////先按象限排序,再按极角排序,再按远近排序 // a.x -= C.x; // a.y -= C.y; // b.x -= C.x; // b.y -= C.y; //// if (a.y == 0 && b.y == 0 && a.x * b.x <= 0) //// return a.x > b.x; //// if (a.y == 0 && a.x >= 0 && b.y != 0) //// return 1; //// if (b.y == 0 && b.x >= 0 && a.y != 0) //// return 0; //// if (1ll * b.y * a.y <= 0) //// return a.y > b.y; // point one; // one.y = one.x = 0; // long long ansa = cross(one, a, one, b); // if (ansa != 0) // return ansa > 0; // return abs(a.x - C.x) < abs(b.x - C.x); //} //---------------------------------------- //回文串 int manacher(char* stra, char* strb, int* p, int lena) { if (lena == 0) lena = strlen(stra); for (int i = lena; i >= 0; --i) { //插入'#' strb[i + i + 2] = stra[i]; strb[i + i + 1] = '#'; } strb[0] = '*'; int lenb = 2 * lena + 1; int maxlen = 0; int id = 0; for (int i = 2; i < lenb; ++i) { if (p[id] + id > i) p[i] = min(p[2 * id - i], p[id] + id - i); else p[i] = 1; while (strb[i - p[i]] == strb[i + p[i]]) ++p[i]; if (id + p[id] < i + p[i]) id = i; if (maxlen < p[i]) maxlen = p[i]; } return maxlen - 1; } //---------------------------------------- //KMP int kmp_getnext(char* stra, int* nextval, int lena) { if (lena == 0) lena = strlen(stra); int i = 0, j = -1; nextval[0] = -1; while (i != lena) { if (j == -1 || stra[i] == stra[j]) nextval[++i] = ++j; else j = nextval[j]; } return lena; } //---------------------------------------- //EXKMP int exkmp_getnext(const char* stra, int* nextval, int lena) { if (lena == 0) lena = strlen(stra); int a = 0; nextval[0] = lena; while (a < lena - 1 && stra[a] == stra[a + 1]) a++; nextval[1] = a; a = 1; for (int k = 2; k < lena; k++) { int p = a + nextval[a] - 1, L = nextval[k - a]; if ((k - 1) + L >= p) { int j = (p - k + 1) > 0 ? (p - k + 1) : 0; while (k + j < lena && stra[k + j] == stra[j]) j++; nextval[k] = j; a = k; } else nextval[k] = L; } return lena; } void exkmp_getextand(const char* stra, const char* strb, int* nextval, int* extand, int lena = 0, int lenb = 0) { if (lena == 0) lena = strlen(stra); if (lenb == 0) lenb = strlen(strb); int a = 0; int MinLen = lena < lenb ? lena : lenb; while (a < MinLen && strb[a] == stra[a]) a++; extand[0] = a; a = 0; for (int k = 1; k < lenb; k++) { int p = a + extand[a] - 1, L = nextval[k - a]; if ((k - 1) + L >= p) { int j = (p - k + 1) > 0 ? (p - k + 1) : 0; while (k + j < lenb && j < lena && strb[k + j] == stra[j]) j++; extand[k] = j; a = k; } else extand[k] = L; } } //---------------------------------------- //最大表示法 int MaxmumRepresentation(char* stra, int lena = 0) { if (lena == 0) lena = strlen(stra); int i = 0, j = 1, k = 0, t; for (; i < lena && j < lena && k < lena;) { t = stra[(i + k) % lena] - stra[(j + k) % lena]; if (!t) ++k; else { if (t < 0) i = i + k + 1; else j = j + k + 1; if (i == j) ++j; k = 0; } } return min(i, j); } //最小表示法 int MinmumRepresentation(char* stra, int lena = 0) { if (lena == 0) lena = strlen(stra); int i = 0, j = 1, k = 0, t; for (; i < lena && j < lena && k < lena;) { t = stra[(i + k) % lena] - stra[(j + k) % lena]; if (!t) ++k; else { if (t > 0) i = i + k + 1; else j = j + k + 1; if (i == j) ++j; k = 0; } } return min(i, j); } struct pii { double a; double b; friend int operator<(pii a, pii b) { if (a.a != b.a) return a.a < b.a; return a.b < b.b; } }; struct pq { int l; int r; int i; friend int operator<(pq a, pq b) { if (a.r != b.r) return a.r < b.r; return a.l < b.l; } }; int n, m; int main() { int T; scan(T); while (T--) { scan(n); scan(m); long long suma = 0; long long tmp = 0; while (n--) { scan(tmp); suma += tmp; } while (m--) { scan(tmp); if (tmp > suma) { printf("1"); } else { printf("0"); } } print(); } return 0; }