Price List

Accepts: 880
Submissions: 2184
Time Limit: 2000/1000 MS (Java/Others)
Memory Limit: 262144/131072 K (Java/Others)
Problem Description

There are nnn shops numbered with successive integers from 111 to nnn in Byteland. Every shop sells only one kind of goods, and the price of the iii-th shop's goods is viv_iv​i​​.

Every day, Byteasar will purchase some goods. He will buy at most one piece of goods from each shop. Of course, he can also choose to buy nothing. Back home, Byteasar will calculate the total amount of money he has 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 he wrote down a smaller number, because it seems that he hadn't used too much money.

Please write a program to help Byteasar judge whether each number is sure to be strictly larger than the actual value.

Input

The first line of the input contains an integer TTT (1≤T≤10)(1\leq T\leq 10)(1≤T≤10), denoting the number of test cases.

In each test case, the first line of the input contains two 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 integers v1,v2,...,vnv_1, v_2, ..., v_nv​1​​,v​2​​,...,v​n​​ (1≤vi≤100000)(1\leq v_i\leq 100000)(1≤v​i​​≤100000), 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≤10​18​​), denoting each number on Byteasar's account book.

Output

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

Sample Input
Copy

1
3 3
2 5 4
1
7
10000
Sample Output
Copy

001
#include <iostream>
#include <stdio.h>
#include <string.h>
#define N (1<<12)+5
#define M 12
using namespace std;
int main()
{
//freopen("in.txt","r",stdin);
int t;
long long a,b,n,m,s;
scanf("%d",&t);
while(t--)
{
s=;
scanf("%lld%lld",&n,&m);
for(int i=;i<n;i++)
{
scanf("%lld",&a);
s+=a;
}
for(int i=;i<m;i++)
{
scanf("%lld",&b);
if(b>s)
printf("");
else
printf("");
}
printf("\n");
}
return ;
}

Best Coder #86 1001 Price List(大水题)的更多相关文章

  1. BZOJ_1621_[Usaco2008_Open]_Roads_Around_The_Farm_分岔路口(模拟+大水题)

    描述 http://www.lydsy.com/JudgeOnline/problem.php?id=1621\(n\)头奶牛,刚开始在一起,每次分成\(x\)和\(x+m\)两部分,直到不能再分,问 ...

  2. 第三届山西省赛1004 一道大水题(scanf)

    一道大水题 时间限制: C/C++ 2000ms; Java 4000ms 内存限制: 65535KB 通过次数: 44 总提交次数: 1020 问题描述 Dr. Pan作为上兰帝国ACM的总负责人, ...

  3. PAT甲题题解-1101. Quick Sort (25)-大水题

    快速排序有一个特点,就是在排序过程中,我们会从序列找一个pivot,它前面的都小于它,它后面的都大于它.题目给你n个数的序列,让你找出适合这个序列的pivot有多少个并且输出来. 大水题,正循环和倒着 ...

  4. PAT甲题题解-1117. Eddington Number(25)-(大么个大水题~)

    如题,大水题...贴个代码完事,就这么任性~~ #include <iostream> #include <cstdio> #include <algorithm> ...

  5. 【数据结构】 最小生成树(四)——利用kruskal算法搞定例题×3+变形+一道大水题

    在这一专辑(最小生成树)中的上一期讲到了prim算法,但是prim算法比较难懂,为了避免看不懂,就先用kruskal算法写题吧,下面将会将三道例题,加一道变形,以及一道大水题,水到不用高级数据结构,建 ...

  6. Wannafly挑战赛21:C - 大水题

    链接:Wannafly挑战赛21:C - 大水题 题意: 现在给你N个正整数ai,每个数给出一“好数程度” gi(数值相同但位置不同的数之间可能有不同的好数程度).对于在 i 位置的数,如果有一在j位 ...

  7. 大水题(water)

    题目描述dzy 定义一个 $n^2$ 位的数的生成矩阵 $A$ 为一个大小为 $n \times n$ 且 Aij 为这个数的第 $i \times n+j-n$ 位的矩阵.现在 dzy 有一个数 $ ...

  8. [BFS,大水题] Codeforces 198B Jumping on Walls

    题目:http://codeforces.com/problemset/problem/198/B Jumping on Walls time limit per test 2 seconds mem ...

  9. 补写:Best Coder #85 1001 Sum(前缀和)

    sum Accepts: 640 Submissions: 1744 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/13107 ...

随机推荐

  1. Servlet学习应该注意的几点

    一.Servlet生命周期(即运行过程) (1)初始阶段,调用init()方法 (2)响应客户请求阶段,调用service()方法.由service()方法根据提交方式不同执行doGet()或doPo ...

  2. easyui动态生成列

    需求:一个id对应多个key value 将id作为标识列 key值作为表头 value作为值显示.数据表可分为两张表 param数据表: 下表一个id对应上表多个key及value 如下图 id_p ...

  3. MySQL之最基本命令

    前言:以下是数据库最基础最常用的命令,特别适用初学者练习,希望通过不断练习这些命令来熟练操作.巩固基础,因为只有不断地练习才能将知识真正变成自己的东西. 快速查看以下内容: 操作 命令 创建数据库 C ...

  4. POJ 2472 106 miles to Chicago(Dijstra变形——史上最坑的最长路问题)

    题目链接 :http://poj.org/problem?id=2472 Description In the movie "Blues Brothers", the orphan ...

  5. java中的finally用return也挡不住

    今晚做了科达的题,有一题就是这个意思,我自以为return中断一切,然而事实摆在眼前:

  6. Nunit测试工具使用实例

    前言: 本文主要是介绍了Nunit的基本使用,其中参详了很多已有的文章,由于最近要使用其进行测试,所以对网上的文章做了下整理,同时加入了一些自己的实践. NUnit的属性 TestFixture 它标 ...

  7. eNSP关闭保存文件的提示信息

    总是提示如下信息: Oct 12 2017 23:49:24-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.191.3. ...

  8. python数据结构之树和二叉树(先序遍历、中序遍历和后序遍历)

    python数据结构之树和二叉树(先序遍历.中序遍历和后序遍历) 树 树是\(n\)(\(n\ge 0\))个结点的有限集.在任意一棵非空树中,有且只有一个根结点. 二叉树是有限个元素的集合,该集合或 ...

  9. Coursera_程序设计与算法_计算导论与C语言基础_数组应用练习

    您也可以在我的个人博客中阅读此文章:跳转 编程题#1:求字母的个数 描述 在一个字符串中找出元音字母a,e,i,o,u出现的次数. 输入 输入一行字符串(字符串中可能有空格,请用gets(s)方法把一 ...

  10. Ubuntu下使用网易云音乐

    Ubuntu15真心各种崩溃啊 最后决定还是换成ubuntu14.04LTS了 在win.android平台上网易云音乐好用到爆 ubuntu下没有网易云音乐的客户端怎么能行 https://gith ...