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. android获取周围AP信息(上)

    1.增加权限: 由于此应用需要获取手机的网络信息,wifi信息,因此需要在AndroidManifest.xml文件中添加相关权限,否则会报permission deny错误: 1 <uses- ...

  2. C#文本文件(.txt)读写 [转]

    目录 前言 读取txt文件 写入txt文件 前言 计算机在最初只支持ASCII编码,但是后来为了支持其他语言中的字符(比如汉字)以及一些特殊字符(比如€),就引入了Unicode字符集.基于Unico ...

  3. C# 窗体WinForm中动态显示radioButton实例

    一个项目中用到的实例,根据数据库查询出待显示的radioButton的个数,显示在一个新的窗口中. //动态显示radioButton public void showRadioButton(int ...

  4. 高性能server框架--I/O模型

    socket在创建的时候默认是堵塞的.我们能够通过socket系统调用的第二个參数传递SOCK_NONBLOCK标志,或者通过fcntl系统调用的F_SETFL命令,将其设置为非堵塞的. 堵塞和非堵塞 ...

  5. 【转】打开linux-tcp端口快速回收

    原文:http://www.zhaoxiaodan.com/lnmp/%E6%89%93%E5%BC%80linux-tcp%E7%AB%AF%E5%8F%A3%E5%BF%AB%E9%80%9F%E ...

  6. Android Studio中mac上面的安装

    Android Studio中mac上面的安装 学习了:https://blog.csdn.net/xianrenli38/article/details/79347170 http://www.an ...

  7. 显示器驱动程序 NVIDIA Windows Kernel Mode Driver Version 已停止响应 并且己成功恢复 解决方法

    原文:http://news.160.com/?p=1890 在玩游戏中 经常 出现显示器驱动程序 NVIDIA Windows Kernel Mode Driver Version 已停止响应 并且 ...

  8. 会说话的HTML--语义化杂谭-TGideas-腾讯游戏官方设计团队

    家里有个熊孩子,经常会有一些意想不到的事情发生:回家的时候,他会笑呵呵冲过来,大声喊着“臭爸爸”:你让他把鞋穿上,他会提起鞋子往楼下扔...在小孩的世界里,他虽然会说话,但不一定明白其中的意思,不能正 ...

  9. Apache问题综述

    1.配置好了,访问的时候出现Forbbiden,如下图:解决方法:1.修改读写权限: 2.将配置文件中httpd.conf的<Directory>中的Denly from all 改成Al ...

  10. 机器学习实战之PCA

    1.  向量及其基变换 1.1 向量内积 (1)两个维数同样的向量的内积定义例如以下: 内积运算将两个向量映射为一个实数. (2) 内积的几何意义 如果A\B是两个n维向量, n维向量能够等价表示为n ...