Arkady coordinates rounds on some not really famous competitive programming platform. Each round features nn problems of distinct difficulty, the difficulties are numbered from 11 to nn.

To hold a round Arkady needs nn new (not used previously) problems, one for each difficulty. As for now, Arkady creates all the problems himself, but unfortunately, he can't just create a problem of a desired difficulty. Instead, when he creates a problem, he evaluates its difficulty from 11 to nn and puts it into the problems pool.

At each moment when Arkady can choose a set of nn new problems of distinct difficulties from the pool, he holds a round with these problems and removes them from the pool. Arkady always creates one problem at a time, so if he can hold a round after creating a problem, he immediately does it.

You are given a sequence of problems' difficulties in the order Arkady created them. For each problem, determine whether Arkady held the round right after creating this problem, or not. Initially the problems pool is empty.

Input

The first line contains two integers nn and mm (1≤n,m≤1051≤n,m≤105) — the number of difficulty levels and the number of problems Arkady created.

The second line contains mm integers a1,a2,…,ama1,a2,…,am (1≤ai≤n1≤ai≤n) — the problems' difficulties in the order Arkady created them.

Output

Print a line containing mm digits. The ii-th digit should be 11 if Arkady held the round after creation of the ii-th problem, and 00 otherwise.

Examples

input

Copy

3 11
2 3 1 2 2 2 3 2 2 3 1

output

Copy

00100000001

input

Copy

4 8
4 1 3 3 2 3 3 3

output

Copy

00001000

Note

In the first example Arkady held the round after the first three problems, because they are of distinct difficulties, and then only after the last problem.

思路:一开始理解错题意了,以前剩下的题目也要算在后边,故可以用标记数组的量来检测

代码:

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring> using namespace std;
int vis[100005],a[100005];
int main()
{ int n,m;
cin>>n>>m;
int sum=0;
for(int t=0;t<m;t++)
{
scanf("%d",&a[t]);
if(vis[a[t]]==0)
{
sum++; }
vis[a[t]]++; if(sum==n)
{
printf("1");
sum=0;
for(int j=1;j<=n;j++)
{
vis[j]--;
if(vis[j]>0)
{
sum++; }
} }
else if(sum<n)
{
printf("0");
} }
return 0;
}

Codeforces Round #532 (Div. 2)- B(思维)的更多相关文章

  1. Codeforces Round #532 (Div. 2)

    Codeforces Round #532 (Div. 2) A - Roman and Browser #include<bits/stdc++.h> #include<iostr ...

  2. Codeforces Round #532 (Div. 2) 题解

    Codeforces Round #532 (Div. 2) 题目总链接:https://codeforces.com/contest/1100 A. Roman and Browser 题意: 给出 ...

  3. Codeforces Round #532 (Div. 2)- A(思维)

    This morning, Roman woke up and opened the browser with nn opened tabs numbered from 11 to nn. There ...

  4. 【CF1256】Codeforces Round #598 (Div. 3) 【思维+贪心+DP】

    https://codeforces.com/contest/1256 A:Payment Without Change[思维] 题意:给你a个价值n的物品和b个价值1的物品,问是否存在取物方案使得价 ...

  5. Codeforces Round #143 (Div. 2) (ABCD 思维场)

    题目连链接:http://codeforces.com/contest/231 A. Team time limit per test:2 seconds memory limit per test: ...

  6. Codeforces Round #395 (Div. 2)(A.思维,B,水)

    A. Taymyr is calling you time limit per test:1 second memory limit per test:256 megabytes input:stan ...

  7. Codeforces Round #416 (Div. 2)(A,思维题,暴力,B,思维题,暴力)

    A. Vladik and Courtesy time limit per test:2 seconds memory limit per test:256 megabytes input:stand ...

  8. Codeforces Round #532 (Div. 2) F 线性基(新坑) + 贪心 + 离线处理

    https://codeforces.com/contest/1100/problem/F 题意 一个有n个数组c[],q次询问,每次询问一个区间的子集最大异或和 题解 单问区间子集最大异或和,线性基 ...

  9. Codeforces Round #533 (Div. 2) C.思维dp D. 多源BFS

    题目链接:https://codeforces.com/contest/1105 C. Ayoub and Lost Array 题目大意:一个长度为n的数组,数组的元素都在[L,R]之间,并且数组全 ...

随机推荐

  1. 【知识碎片】Net项目经验积累

    后台传JSON到js报错 MVC控制器传json到前端JS"变为" 导致JS报错 重点是一定要在@ViewBag.typeJson两边加双引号,并且后台用 编码前台解码 ViewB ...

  2. 【271】IDL-ENVI二次开发

    参考:String Processing Routines —— 字符串处理函数 01   STRING 返回字符串. 02   STRCMP 比较字符串,一样返回1,不一样返回0,默认大小写敏感. ...

  3. python的程序书写以及保存

    在前面的微博里已经叙述Python的安装以及路径的设置. 在我们的windows的电脑上面我们已经安装完了python以及设置了它的路径,所以我们可以再cmd里面进行Python的编写(cmd的快速打 ...

  4. sqlplus 连接数据库执行SP

    .bashrc export HOME= export LANG="C" .bash_profile #明码 #export LOG_USER=lhcx #export LOG_P ...

  5. Linux_oracle命令大全(转)

    Linux_oracle命令大全 一,启动 1.#su - oracle              切换到oracle用户且切换到它的环境 2.$lsnrctl status           查看 ...

  6. Windows版本Apache+php的Xhprof应用__[2]

    [计划] “Windows版本Apache+php的Xhprof应用__[1]”中已经解决了下载,配置的问题,所以这里的工作是接着进行的,我们以调试一个 php代码的文件来看看是怎么用xhprof的. ...

  7. go install 命令

    go install 命令简介 用于编译并安装代码包或源代码文件 安装代码包会在当前工作区的 'pkg/<平台相关目录>'下生成'归档文件' 安装命令源码文件会在当前工作区的'bin'目录 ...

  8. springJDBC01 利用springJDBC操作数据库

    1 什么是springJDBC spring通过抽象JDBC访问并一致的API来简化JDBC编程的工作量.我们只需要声明SQL.调用合适的SpringJDBC框架API.处理结果集即可.事务由Spri ...

  9. SDUT 2129 树结构练习——判断给定森林中有多少棵树

    树结构练习——判断给定森林中有多少棵树 Time Limit: 1000MS Memory Limit: 65536KB Submit Statistic Problem Description  众 ...

  10. HTML 4.0 触发事件

    HTML 4 的新特性之一是可以使 HTML 事件触发浏览器中的行为,比方说当用户点击某个 HTML 元素时启动一段 JavaScript. 在现代浏览器中都内置有大量的事件处理器.这些处理器会监视特 ...