CF-1004B-Sony and Exhibition-大水题

题源:http://codeforces.com/problemset/problem/1004/B
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 i-th position. Thus each of n 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.InputThe first line contains two integers n and m
(1≤n,m≤10^3) — the number of flowers and visitors respectively.Each of the next m lines contains two integers lili and riri
(1≤li≤ri≤n1≤li≤ri≤n), meaning that i-th visitor will visit all flowers from lili
to riri inclusive.OutputPrint 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.
Examples
Input
5 3
1 3
2 4
2 5
Output
01100

Input
6 3
5 6
1 4
4 6
Output
110010
—————————————————————————————
思路:一看这题这么长又不容易懂其实就是个超级辣鸡的水题。
题目的意思是sonya把两种花种一排(相当于一个数轴),然后客人们只参观自己闭区间的花,让你排列好所有的花,使得每个客人看到的两种花数目乘积最大。
小学学过,两个矩形,周长一样的情况下,长和宽越接近,乘积越大。此处同理,如果想让两种花数目乘积越大,就应该让它们尽量各占一半。
那么不管客人看哪里的花,只要让lily和rose间隔排列就行!!!用1和0分别代替两种花,即1010101010……即可,反过来也行。
就是个大水题!!!
AC代码如下:

#include<stdio.h>
int main()
{ //这什么智障题目?!! 
 int n,m,i,j,in[1000][2],out[1001];
 scanf("%d%d",&n,&m);
 for(i=0;i<m;i++)
 for(j=0;j<2;j++)
 scanf("%d",&in[i][j]);
 
 for(i=0;i<n;i++)
 if(i%2) printf("0");
 else printf("1");
 return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值