Team

CodeForces - 401C

Now it's time of Olympiads. Vanya and Egor decided to make his own team to take part in a programming Olympiad. They've been best friends ever since primary school and hopefully, that can somehow help them in teamwork.

For each team Olympiad, Vanya takes his play cards with numbers. He takes only the cards containing numbers 1 and 0. The boys are very superstitious. They think that they can do well at the Olympiad if they begin with laying all the cards in a row so that:

  • there wouldn't be a pair of any side-adjacent cards with zeroes in a row;
  • there wouldn't be a group of three consecutive cards containing numbers one.

Today Vanya brought n cards with zeroes and m cards with numbers one. The number of cards was so much that the friends do not know how to put all those cards in the described way. Help them find the required arrangement of the cards or else tell the guys that it is impossible to arrange cards in such a way.

Input

The first line contains two integers: n (1 ≤ n ≤ 106) — the number of cards containing number 0; m (1 ≤ m ≤ 106) — the number of cards containing number 1.

Output

In a single line print the required sequence of zeroes and ones without any spaces. If such sequence is impossible to obtain, print -1.

Examples

Input
1 2
Output
101
Input
4 8
Output
110110110101
Input
4 10
Output
11011011011011
Input
1 5
Output
-1

sol:这还是挺好构造的吧(虽然我挂的很惨惨惨惨惨惨惨)
如果1比0的两倍还多3个或者0比1多2个就GG了,否则就一定能构造出来
如果1比0多就先用110,再用10
如果0比1多就一直用010101,最后来个0
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
inline ll read()
{
ll s=;
bool f=;
char ch=' ';
while(!isdigit(ch))
{
f|=(ch=='-'); ch=getchar();
}
while(isdigit(ch))
{
s=(s<<)+(s<<)+(ch^); ch=getchar();
}
return (f)?(-s):(s);
}
#define R(x) x=read()
inline void write(ll x)
{
if(x<)
{
putchar('-'); x=-x;
}
if(x<)
{
putchar(x+''); return;
}
write(x/);
putchar((x%)+'');
return;
}
#define W(x) write(x),putchar(' ')
#define Wl(x) write(x),putchar('\n')
int n,m; //n个0,m个1
int main()
{
R(n); R(m);
if(m-n*>) return *puts("-1");
if(n-m>) return *puts("-1");
if(m>=n)
{
while(m>n&&n)
{
putchar(''); putchar(''); putchar('');
m-=; n--;
}
if(n==)
{
while(m--) putchar('');
}
else
{
while(m--)
{
putchar(''); putchar('');
}
}
}
else
{
while(m--)
{
putchar(''); putchar('');
}
putchar('');
}
return ;
}
/*
input
1 2
output
101 input
4 8
output
110110110101 input
4 10
output
11011011011011 input
1 5
output
-1
*/
 

codeforces401C的更多相关文章

随机推荐

  1. 在Ubuntu上快速搭建基于Beego的RESTful API

    最近在研究Go,打算基于Go做点Web API,于是经过初步调研,打算用Beego这个框架,然后再结合其中提供的ORM以及Swagger的集成,可以快速搭建一个RESTful API的网站. 下面是具 ...

  2. 用C# 模拟实现unity里的协程

    注:需要了解C#的迭代器,不然很难理解. 之前面试有被问到unity协程的原理,以及撇开unity用纯C#去实现协程的方法.后来了解一下,确实可以的.趁这会有空,稍微总结一下. 还是结合代码说事吧: ...

  3. 使用Windows Live Writer撰写的第一篇博文

    一直没有时间,在自己的电脑上配置起来Windows Live Writer. 今天抽时间搞起来后,感觉果然比在Web版写作不知道爽多少倍哦. 还安装了代码插件,上传代码和图片也方便了很多,霸气. 先上 ...

  4. [C#]SQL Server Express LocalDb(SqlLocalDb)的一些体会

    真觉得自己的知识面还是比较窄,在此之前,居然还不知道SqlLocalDb. SqlLocalDb是啥?其实就是简化SQL Server的本地数据库,可以这样子说,SQL Server既可以作为远程,也 ...

  5. 每秒高达1.6亿次操作的并发键值存储库 FASTER 诞生

    FASTER 在过去十年中,云中的数据密集型应用程序和服务有了巨大的增长.数据在各种边设施(例如,设备,浏览器和服务器)上创建,并由云应用程序处理用来获得数据价值或做出决策.应用程序和服务可以处理收集 ...

  6. ASP.NET Core 企业开发架构概述

    企业开发框架包括垂直方向架构和水平方向架构.垂直方向架构是指一个应用程序的由下到上叠加多层的架构,同时这样的程序又叫整体式程序.水平方向架构是指将大应用分成若干小的应用实现系统功能的架构,同时这样的系 ...

  7. python-入门的第一个爬虫例子

    前言: 此文为大家入门爬虫来做一次简单的例子,让大家更直观的来了解爬虫. 本次我们利用 Requests 和正则表达式来抓取豆瓣电影的相关内容. 一.本次目标: 我们要提取出豆瓣电影-正在上映电影名称 ...

  8. Linux下php安装redis扩展(redis已经安装)

     1. 下载需要的php操作redis的扩展包 (1).切换到 cd  /usr/local/src (2).   wget https://github.com/nicolasff/phpredis ...

  9. 【转】Linux下cp: omitting directory `XXX'问题解决

    在linux系统中复制文件夹时提示如下: Shell代码 [root@idtp4 site-packages]# /site-packages/ cp: omitting directory ‘yag ...

  10. mysql之找回误删数据

    场景:我们开发阶段,经常要有一些测试数据在我们测试相关功能的时候,是十分必要的.后期由于引入了正式的数据,但是测试数据并没有被及时清理.这个时候由于一个误删除,导致一些正式的数据被删除,由此,一场追找 ...