HDU Price List

Source: Internet
Author: User

Price Listaccepts:1029submissions:2020Time limit:2000/1000 MS (java/others)Memory limit:262144/131072 K (java/others) Problem Description

There is nnn Shops numbered with successive integers from 1 To nnn In Byteland. Every shop sells only one kind of goods, and the price of the IIi -th Shop ' s goods are viv_iv? I ??.

Every day, Byteasar'll purchase some goods. He'll buy at the most one piece of goods from each shop. Of course, he can also choose to buy nothing. Back home, Byteasar would calculate the total amount of money he had costed that day and write it down on his account book.

However, due to Byteasar's poor math, he may calculate a wrong number. Byteasar would not mind if the he wrote down a smaller number, because it seems the He hadn ' t used too much money.

Byteasar judge whether each number was sure to be strictly larger than the actual value.

Input

The first line of the input contains an integer tt t (1≤t≤10) (1\ Leq t\leq ( 1 ≤ t ≤ 1 0 , denoting the number of test cases.

The first line of the input contains the integers n,mn,mN, m ( 1≤n,m≤100000) (1\leq n,m\leq 100000)(1≤n ,m≤100000 ), denoting the number of shops and the number of records on Byteasar's account book.

The second line of the input contains nnn Integersv1,v2,..., vnv_1, v_2, ..., V_n v? 1 ??, v? 2 ??,..., v? N ??(1≤vi≤100000) (1\leq v_i\leq 100000) (1≤v? ) I ?? ≤ 1 0 0 0 0 0 ), denoting the price of the IIi -th Shop ' s goods.

Each of the next mmm Lines contains an integer QQq (0≤q≤1018) (0\leq q\leq 10^{18}) ( 0 ≤ q ≤ 1 0 1 8 ? ) , denoting each number on Byteasar's account book.

Output

For each test case, the print a line with mmm Characters. If the IIi -th number is sure to being strictly larger than the actual value, then the IIi -th character should be ' 1 '. Otherwise, it should be ' 0 '.

Sample Input
13 32 5 41710000
Sample Output
001

Water problem, if the number of inputs than the sum of large output 1 otherwise output 0


/************************************************┆┏┓┏┓┆┆┏┛┻━━━┛┻┓┆┆┃┃┆┆┃━┃┆┆┃┳┛┗┳┃┆┆┃┃┆┆   ┃┻┃┆┆┗━┓┏━┛┆┆┃┃┆┆┃┗━━━┓┆┆┃ac Horse ┣┓┆┆┃┏┛┆┆┗┓┓┏━┳┓┏┛┆┆┃┫┫┃┫┫┆┆ ┗┻┛┗┻┛┆************************************************ * * #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <vector> #include <algorithm> #include <iostream>#    Include<queue> #include <map> #define LL long longusing namespace Std;int main () {int t;    scanf ("%d", &t);        while (t--) {int n,m;        scanf ("%d%d", &n,&m);        ll Sum=0;            for (int i=0;i<n;i++) {ll A;            scanf ("%lld", &a);        Sum+=a;            } for (int i=0;i<m;i++) {ll A;            scanf ("%lld", &a);            if (a<=sum) printf ("0");        else printf ("1");    } printf ("\ n"); }}



HDU Price List

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.