B. Sonya and Exhibition
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

Sonya decided to organize an exhibition of flowers. Since the girl likes only roses and lilies, she decided that only these two kinds of flowers should be in this exhibition.

There are nn flowers in a row in the exhibition. Sonya can put either a rose or a lily in the ii-th position. Thus each of nn positions should contain exactly one flower: a rose or a lily.

She knows that exactly mm people will visit this exhibition. The ii-th visitor will visit all flowers from lili to riri inclusive. The girl knows that each segment has its own beauty that is equal to the product of the number of roses and the number of lilies.

Sonya wants her exhibition to be liked by a lot of people. That is why she wants to put the flowers in such way that the sum of beauties of all segments would be maximum possible.

Input

The first line contains two integers nn and mm (1≤n,m≤1031≤n,m≤103) — the number of flowers and visitors respectively.

Each of the next mm lines contains two integers lili and riri (1≤li≤ri≤n1≤li≤ri≤n), meaning that ii-th visitor will visit all flowers from lili to ririinclusive.

Output

Print the string of nn characters. The ii-th symbol should be «0» if you want to put a rose in the ii-th position, otherwise «1» if you want to put a lily.

If there are multiple answers, print any.

Examples
Input
5 3
1 3
2 4
2 5
Output
01100
Input
6 3
5 6
1 4
4 6
Output
110010

Note

In the first example, Sonya can put roses in the first, fourth, and fifth positions, and lilies in the second and third positions;

  • in the segment [1…3][1…3], there are one rose and two lilies, so the beauty is equal to 1⋅2=21⋅2=2;
  • in the segment [2…4][2…4], there are one rose and two lilies, so the beauty is equal to 1⋅2=21⋅2=2;
  • in the segment [2…5][2…5], there are two roses and two lilies, so the beauty is equal to 2⋅2=42⋅2=4.

The total beauty is equal to 2+2+4=82+2+4=8.

In the second example, Sonya can put roses in the third, fourth, and sixth positions, and lilies in the first, second, and fifth positions;

  • in the segment [5…6][5…6], there are one rose and one lily, so the beauty is equal to 1⋅1=11⋅1=1;
  • in the segment [1…4][1…4], there are two roses and two lilies, so the beauty is equal to 2⋅2=42⋅2=4;
  • in the segment [4…6][4…6], there are two roses and one lily, so the beauty is equal to 2⋅1=22⋅1=2.

The total beauty is equal to 1+4+2=71+4+2=7.

题目大意:

有一排n个格子,每个格子里能放一种花,一共有两种花,一种用 0 代表,另一种用 1 代表,然后给你m各区间,每个区间的价值就是这个区间内的两种花的数量之积。问你应该怎么放花,使得这些区间的价值和最大。

分析:

题目的意思转化一下,就是说让0 1 的个数在各个区间内都是接近的(和相等,越接近,积越大),也就是说0 1 分布均匀,那么,我们直接0 1 交替输出,就可以保证0 1 在各个区间都是最接近的。(一开始想了好久,woc,这个放置的方法真的是太绝了,区间根本就是坑啊)

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<sstream>
#include<cmath>
#include<cstdlib>
#include<queue>
using namespace std; #define ll long long
#define llu unsigned long long
#define INF 0x3f3f3f3f
#define PI acos(-1.0)
const int maxn = ; int main()
{
int n,m;
scanf("%d%d",&n,&m);
for(int i=;i<m;i++)
{
int l,r;
scanf("%d%d",&l,&r);
}
for(int i=;i<=n;i++)
{
printf("%d",i%);
}
}

最新文章

  1. 10个顶级的CSS UI开源框架
  2. [翻译]:怎样从C/C++代码中对C#进行回调
  3. java遍历Map的几种方式
  4. Hadoop-- MapReduce简单理解
  5. JavaScript入门介绍(二)
  6. QStandardItemModel角色控制及QTreeView加入不同的右键菜单
  7. Iis 日志文件默认路径
  8. 高速压缩跟踪(fast compressive tracking)(CT)算法分析
  9. ASP.NET没有魔法——ASP.NET MVC 路由的匹配与处理
  10. 分享一个android静默安装,安装后重新启动app的方法
  11. Python面向对象基础知识
  12. android从IIS/asp.net下载apk文件
  13. Linux下的5种I/O模型(转)
  14. web前端 ajax请求报415/400错
  15. 【javaScript】数组的相关操作
  16. java list按照 对象 指定多个字段属性进行排序
  17. 【项目管理】git和码云的使用
  18. python mysql开发日志
  19. 20155226 2016-2017-2 《Java程序设计》课程总结
  20. leetcode个人题解——#33 Search in Rotated Sorted Array

热门文章

  1. Python3基础(5)常用模块:time、datetime、random、os、sys、shutil、shelve、xml处理、ConfigParser、hashlib、re
  2. Vue小贴士
  3. ECShop配置文件解析
  4. 【踩坑】服务器部署springboot应用时报错--端口被tomcat占用
  5. nsight 中出现method could not be resolved 报错
  6. ArcGIS API for JavaScript开发初探——HelloMap
  7. WebChromeClient
  8. Spring IoC和AOP的介绍
  9. 【硬盘整理】使用UltimateDefrag将常用文件放置在磁盘最外圈
  10. java Vamei快速教程21 事件响应