305300: CF1004B. Sonya and Exhibition
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Sonya and Exhibition
题意翻译
Sonya 要办一场花卉展览,不过 Sonya 只喜欢玫瑰花和百合花。 $n$ 朵花排成一排,每朵花只能是玫瑰或者百合其中的一种。 有 $m$ 个客人要来参观她的展览,第 $i$ 个客人会看 $[l_i,r_i]$ 之间的花朵。 定义一个区间的美丽程度为,这个区间内玫瑰花的数量乘以百合花的数量。 Sonya 想请你来帮忙摆花,使得这 $m$ 个区间的美丽程度之和最大。 输出一个长度为 $n$ 的 01 串,表示你的方案。题目描述
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 $ n $ flowers in a row in the exhibition. Sonya can put either a rose or a lily in the $ i $ -th position. Thus each of $ n $ positions should contain exactly one flower: a rose or a lily. She knows that exactly $ m $ people will visit this exhibition. The $ i $ -th visitor will visit all flowers from $ l_i $ to $ r_i $ 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.输入输出格式
输入格式
The first line contains two integers $ n $ and $ m $ ( $ 1\leq n, m\leq 10^3 $ ) — the number of flowers and visitors respectively. Each of the next $ m $ lines contains two integers $ l_i $ and $ r_i $ ( $ 1\leq l_i\leq r_i\leq n $ ), meaning that $ i $ -th visitor will visit all flowers from $ l_i $ to $ r_i $ inclusive.
输出格式
Print the string of $ n $ characters. The $ i $ -th symbol should be «0» if you want to put a rose in the $ i $ -th position, otherwise «1» if you want to put a lily. If there are multiple answers, print any.
输入输出样例
输入样例 #1
5 3
1 3
2 4
2 5
输出样例 #1
01100
输入样例 #2
6 3
5 6
1 4
4 6
输出样例 #2
110010