C. Team
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

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.

Sample test(s)
Input
1 2
Output
101
Input
4 8
Output
110110110101
Input
4 10
Output
11011011011011
Input
1 5
Output
-1
讲解:n个0,和m个1,组成的1和0的组合,且不能连续出现两个0挨着,也不能同时出现3个1挨着:
AC代码:
 #include<cstdio>
#include<iostream>
using namespace std;
int main()
{
int a,b;
while (~scanf("%d %d",&a,&b))
{
if (b>*a+||a>b+)
puts("-1");
else
{
if (a==b+)
{
printf("");
a--;
}
while (a+b>)
{
if (b>a && a>)
{
printf("");
b-=,a--;
} else if (b==a)
{
printf("");
a--;b--;
} if (a== && b!=)
{
printf("");
b--;
}
}
}
puts("");
}
return ;
}

Codeforces Round #235 (Div. 2) C. Team的更多相关文章

  1. Codeforces Round #235 (Div. 2)C、Team

    #include <iostream> #include <algorithm> using namespace std; int main(){ int n,m; cin & ...

  2. Codeforces Round #235 (Div. 2)

    A. Vanya and Cards time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  3. Codeforces Round #235 (Div. 2) D. Roman and Numbers(如压力dp)

    Roman and Numbers time limit per test 4 seconds memory limit per test 512 megabytes input standard i ...

  4. codeforces水题100道 第十一题 Codeforces Round #143 (Div. 2) A. Team (brute force)

    题目链接:http://www.codeforces.com/problemset/problem/231/A题意:问n道题目当中有多少道题目是至少两个人会的.C++代码: #include < ...

  5. Codeforces Round #235 (Div. 2) D. Roman and Numbers 状压dp+数位dp

    题目链接: http://codeforces.com/problemset/problem/401/D D. Roman and Numbers time limit per test4 secon ...

  6. Codeforces Round #235 (Div. 2) B. Sereja and Contests

    #include <iostream> #include <vector> #include <algorithm> using namespace std; in ...

  7. Codeforces Round #235 (Div. 2) A. Vanya and Cards

    #include <iostream> using namespace std; int main(){ int n,x; cin >> n >> x; ; ; i ...

  8. Codeforces Round #235 (Div. 2) D. Roman and Numbers (数位dp、状态压缩)

    D. Roman and Numbers time limit per test 4 seconds memory limit per test 512 megabytes input standar ...

  9. Codeforces Round #279 (Div. 2) A. Team Olympiad 水题

    #include<stdio.h> #include<iostream> #include<memory.h> #include<math.h> usi ...

随机推荐

  1. 如何安装pip、升级pip包。mac下安装包的路径

    参考:https://pip.pypa.io/en/stable/installing/ 1.wget -c  https://bootstrap.pypa.io/get-pip.py 2.pytho ...

  2. 数学图形(2.8)Viviani曲线

    维维亚尼(Viviani , Vincenzo)意大利数学家.1622年4月5日生于托斯卡纳大区佛罗伦萨:1703年9月22日卒于佛罗伦萨. 这是一个圆柱与一个球相交而生成的曲线. #http://w ...

  3. 查看网络IP连接

  4. 一些C++11语言新特性 - Range-Based for Loops

    1. Range-Based for Loops for ( decl : coll ) { statement} eg: , , , , , , , } ) { std::cout << ...

  5. 解决iOS Xcode 模拟器键盘不弹出

    1. 选中模拟器,在屏幕上方的菜单中找到Hardware->Keyboard 2. 直接快捷键shift+command+k

  6. FFmpeg视频处理必备

    http://ffmpeg.org/官网 A complete, cross-platform solution to record, convert and stream audio and vid ...

  7. webpack 引入jquery和第三方jquery插件

    1.引入jquery jQuery 直接在 html 中引入,然后在 webpack 中把它配置为全局即可. index.html: <!DOCTYPE html> <html> ...

  8. PHP文件系统处理

    文件系统概述 文件类型         PHP是以UNIX的文件系统为模型的,因此Windows系统中我们只能获得"file"."dir"或者"unk ...

  9. 参数依赖查找(ADL,Argument-dependent lookup)

    参数依赖查找(Argument-dependent lookup),又称 ADL 或 Koenig 查找,是一组于函数调用表达式查找非限定函数名的规则,包含对重载运算符的隐式函数调用.在通常非限定名称 ...

  10. webp转jpg

      webp转jpg CreateTime--2017年12月8日09:32:38 Author:Marydon 1.webp格式介绍 WebP 的优势体现在它具有更优的图像数据压缩算法,能带来更小的 ...