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. Csharp—碎片知识积累

    1.获取应用程序的工作目录 2.将两个字符串组成一个新的路径: 3.MessageBox使用(弹出一个消息框)(第一个参数是消息内容,第二个参数是消息标题,第三个参数是按钮设置,第四个参数是消息内容前 ...

  2. Generative Adversarial Nets[CAAE]

    本文来自<Age Progression/Regression by Conditional Adversarial Autoencoder>,时间线为2017年2月. 该文很有意思,是如 ...

  3. 典型分布式系统分析:Bigtable

    本文是典型分布式系统分析的第三篇,分析的是Bigtable,一个结构化的分布式存储系统. Bigtable作为一个分布式存储系统,和其他分布式系统一样,需要保证可扩展.高可用与高性能.与此同时,Big ...

  4. 关于vue的混入使用

    普通使用: 定义一个 mixin.js文件 随便定一些数据 记得后面导出 然后在需要用的文件 就可以获取了. 全局混合: 引入vue 全局注册混合 main.js 入口文件引入 然后就可以在所有页面使 ...

  5. UVA - 10931-Parity

    题意:1.输入一个数,将其转换为二进制.2.记录二进制中出现1的次数. 注意:转换二进制后直接输出,不能转换为十进制后输出 #include<iostream> #include<c ...

  6. mysql安装与配置详情

    一.概述 MySQL版本:5.6.43 下载地址:mysql-installer-community-5.6.43.0,提取码:tgmk 客户端工具:NavicatforMySQL 下载地址:Navi ...

  7. .Net外包篇:我是怎么看待外包的(二)

    延续上篇文章.net外包篇:我是如何看待外包的. 从这家公司辞职以后,得益于我校园信息平台和高校信息管理的经验,我进入了一个互联网类型公司.以前的经历,环环相扣,步步提升. 互联网时代 第四家客户(未 ...

  8. 微软Ignite2018——微软宣布新的学习平台:Microsoft Learn

    Ignite 2018 首日感受 头一次参加美国的微软 Ignite 大会,确实规模比国内的大不少.23日是 MVP & RD 的 Pre Day(MVP即Most Valuable Prof ...

  9. [故障公告]阿里云“华东1地域部分负载均衡https访问异常“引起部分站点无法访问

    今天上午 9:40 - 11:06 左右,由于阿里云“华东1地域部分负载均衡https访问异常”,造成我们的部分站点(尤其是博客后台)无法正常访问,给您带来了很大的麻烦,请您谅解. 现已恢复正常,如果 ...

  10. Node 系列之path模块

    //引用该模块 var path = require("path"); 1.路径解析,得到规范化的路径格式 //对window系统,目录分隔为'\', 对于UNIX系统,分隔符为' ...