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. [UIKit学习]00.关于前置知识(storyboard,UIViewController,类扩展,项目属性)

    storyboard文件的认识 用来描述软件界面 默认情况下,程序一启动就会加载Main.storyboard 加载storyboard时,会首先创建和显示箭头所指的控制器界面 IBAction和IB ...

  2. Flask-WTF 配置、验证及日志P4

    参数配置 参数 说明 WTF_CSRF_ENABLED 设置为False以禁用所有CSRF保护 WTF_CSRF_CHECK_DEFAULT 使用CSRF保护扩展时,这可以控制每个视图是否受到默认保护 ...

  3. window、linux系统与linux服务器之间使用svn同步及自动部署代码的方法

    摘要: 在家用PC,在公司用办公电脑对一个项目的代码进行修改时,会遇到代码同步的问题.本文讲解了代码同步及自动部署的解决办法. 实现方法: 1.首先在linux服务器上和linux上安装svn(sud ...

  4. 15 Validation

    一.模型选择问题 如何选择? 视觉上 NO 不是所有资料都能可视化;人脑模型复杂度也得算上 通过Ein NO 容易过拟合;泛化能力差 通过Etest NO 能保证好的泛化,不过往往没法提前获得测试资料 ...

  5. js中set和get的用法

    get 语句作为函数绑定在对象的属性上,当访问该属性时调用该函数. set 语法可以将一个函数绑定在当前对象的指定属性上,当那个属性被赋值时,你所绑定的函数就会被调用. eg: var log = [ ...

  6. jdk版本查看,以及java -version 和JAVA_HOME不一致问题

    一.jdk版本查看及位数查看 在cmd进入命令行窗口,输入java -version 可以查看安装的jdk版本,如图: 当有64-bit时代表是64位jdk,如果没有则默认是32位的. 二.java ...

  7. linux cpu load学习笔记

    linux系统中的Load对当前CPU工作量的度量 Load Average 就是一段时间 (1 分钟.5分钟.15分钟) 内平均Load. [root@CNC-BJ-5-3N1 ~]# w 20:0 ...

  8. 51nod 1270 数组的最大代价 思路:简单动态规划

    这题是看起来很复杂,但是换个思路就简单了的题目. 首先每个点要么取b[i],要么取1,因为取中间值毫无意义,不能增加最大代价S. 用一个二维数组做动态规划就很简单了. dp[i][0]表示第i个点取1 ...

  9. 宝藏(树形DP)

      这道题目是十分考验思维的,n^2应该还是比较好想的,主要是如何转移根的问题.转移根,在我看来应该是树形dp最难的一部分了, 一般学会如何转移根,也就差不多考验通吃树形dp了. 下面转一转大佬链接: ...

  10. 支持向量机(五)SMO算法

    11 SMO优化算法(Sequential minimal optimization) SMO算法由Microsoft Research的John C. Platt在1998年提出,并成为最快的二次规 ...