Sonya and Exhibition(简单思维题)

数字电视中的AD(Audio Description)音频描述技术详解 AD(Audio Description)音频描述是一种辅助技术,旨在帮助视障人士更好地理解视觉内容。通过在节目或视频的自然停顿处插入额外的语音叙述来解释屏幕上的视觉信息,如人物动作、场景变化、文字说明等,从而让视力受损的人士也能获得完整的观影体验。AD服务不仅限于电视广播,也广泛应用于电影、剧院表演、在线视频平台等领域。PID:用于标识和区分不同的音频流。PMT表:提供每个音频流的详细信息,包括PID、编解码器类型和语言代码。时间戳:PTS和DTS用于同步音频与视频内容。解复用。 阅读详情

Sonya and Exhibition

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 li to ri

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 n

and m (1≤n,m≤103

) — the number of flowers and visitors respectively.

Each of the next m
lines contains two integers li and ri (1≤li≤ri≤n), meaning that i-th visitor will visit all flowers from li to ri

inclusive.

Output

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.

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]

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

.

The total beauty is equal to 2+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]

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

.

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

题意:

要在长度为n的花坛种n颗花(只有玫瑰花和百合花),一共有m个顾客赏花,每个顾客只看(l,r)区间内的花

每个顾客的满意度是所看到的玫瑰花 X 所看的百合花,求如何安排玫瑰花和百合花的位置使得顾客的满意度和最大

分析:

对于每个顾客满意度最大是当所看区间玫瑰花数量与百合花数量相等,所以玫瑰花和百合花可以间隔摆放,和所给区间无关

code:

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main(){
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i = 0; i < m; i++){
        int l,r;
        scanf("%d%d",&l,&r);
    }
    for(int i = 0; i < n; i++){
        printf("%d", i & 1 ? 1 : 0);
    }
    return 0;
}
假期搞定!2026国社科申报AI全攻略指南:从选题到创新,7大核心要点手把手教你! 最后给大家推荐的400多所高校教师都在用的AI平台——高级学术版专业应用平台,集成了国际主流学术应用,以及ChatGPT、Claude、Gemini、Grok等Al大模型的高级版本平台,还有,可以辅助大家高效完成科研和学术写作任务,当然撰写硕博论文,课题、职称论文、国社科、国自然基金本子也是手拿把掐。你的任务是:用高度凝练的方式说明在(某一明确国家战略 / 政策方向,如:中国式现代化、共同富裕、基层治理现代化、数字中国、文化强国、国家安全等)背景下,我究竟要研究一个什么“具体而可操作的问题”。 阅读详情

相关推荐

Sigmastar平台WDR调试实战:从参数解析到鬼影消除的完整指南

本文提供了Sigmastar平台宽动态(WDR)技术的实战调试指南。针对逆光、运动场景下的核心痛点,系统性地解析了从多曝光采集、HDR融合到色调映射的完整管线,并重点阐述了如何通过调整曝光比、运动阈值与调整曲线等关键参数,有效消除运动鬼影、平衡暗部噪声与细节,最终实现清晰稳定的图像效果。

Jerry的专栏 926

Sonya and Exhibition(CodeForces 1004B)

Description 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...

Baiyi_destroyer的博客 570

Xshell 连接 kali 虚拟机教程

启动ssh服务,启动后重新查看ssh服务状态,如下图active(running)正常。至此便可以直接使用Xshell登录kali系统了。至此虚拟机已经可以上网。-查看ssh服务状态。

qq_40726937的博客 2219

B. Sonya and Exhibition

B. Sonya and Exhibition#include &lt;bits/stdc++.h&gt; using namespace std ; int main(){ int n; scanf("%d",&amp;n) ; for (int i=1;i&lt;=n;i++) printf("%d",i&amp;1) ; }

scy1106的博客 337

UART全功能测试指南:环路/DMA/RS485/硬件流控实战

UART(通用异步收发器)是嵌入式系统中最基础的串行通信接口,其核心原理基于起始位、数据位、校验位与停止位的异步帧结构,依赖精确的波特率时钟同步与采样重建机制。在工业与物联网场景中,UART不仅需保障基本通信可靠性,更需支持DMA卸载、RS485半双工自动方向控制、RTS/CTS硬件流控等进阶能力,以提升实时性、抗干扰性与系统资源效率。典型应用涵盖调试日志输出、传感器数据采集、Modbus RTU总线通信及固件空中升级。本指南聚焦UART外设测试实践,覆盖环路自检、DMA吞吐验证、RS485时序对齐、硬件流

weixin_42599908的博客 133

学习STM32的无人机控制

下面是一个基于STM32的无人机控制的简单示例代码,包括四旋翼的PID控制、遥控器信号解析和电机控制。本示例以STM32F103系列为例,使用Keil C编译器进行开发。

qq_67153941的博客 706

Sonya and Exhibition CodeForces - 1004B(水题)

B. Sonya and Exhibitiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputSonya decided to organize an exhibition of flowers. Since the girl likes onl...

JiaYao的博客 444

【提示学习代码】CoOp代码详读

CoOp是对CLIP的改进工作,主要是对prompt进行学习从而不用来手动设置prompt。自定义CLIP模型:上述两个模块结合而成的CLIP。文本编码器,接收文本的输入,并输出相应的编码表示。将图像和文本进行编码并计算它们之间的相似性。permute后变成了(4,2,3)Prompt学习器,用于学习生成提示。

weixin_51293984的博客 5816

CF B. Sonya and Exhibition

A. Sonya and Hotels题目网址点击打开链接time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputSonya decided that having her own hotel business is the best way of ea...

这可是一个难过的暑假哇,别白过 261

【PCL 特征】积分图法线估计

本文介绍了基于积分图的有序点云法线估计方法。通过利用点云数据的行列式结构特性,该方法避免了传统KD树搜索,采用积分图将邻域统计运算复杂度从O(k²)降至O(1)。详细阐述了四种法线估计算法:协方差矩阵法(精度最高)、平均3D梯度法(实时性好)、平均深度变化法(适合SLAM)和简单3D梯度法(速度最快)。重点分析了积分图构建、动态窗口平滑处理、法线方向调整等关键技术,并提供了PCL实现代码示例。实验表明,不同方法在精度和速度上存在显著差异,可根据具体应用场景选择合适算法。

yijiujiusan的博客 275

从零开始讲DDR(8)——AXI 接口MIG 使用(1)

我们简单拆解了MIG AXI接口中测试文件的整体框架,首先在sim_tb_top.sv文件中例化了DDR模型和example_top。在example_top中,又例化了MIG IP和一个流量产生器ddr4_v2_2_8_axi_tg_top。在ddr4_v2_2_8_axi_tg_top中的主要功能是分别例化了boot_mode_gen,prbs_mode_gen,custom_mode_gen和axi_opcode_gen。

apple_53311083的博客 1587

C. Sonya and Robots codeforces 1004 -csdn博客

Since Sonya is interested in robotics too, she decided to construct robots that will read and recognize numbers. Sonya has drawn n numbers in a row, ai is located in the i-th position. She also has p...

i-Curve的博客 763

【WorkBuddy从入门到精通实战教程】使用手册 第 2 章 WorkBuddy的下载、安装、登录与更新

摘要:WorkBuddy官方下载地址为https://www.codebuddy.cn/work/,支持Mac和Windows系统,需根据设备自动匹配版本。安装时需核对发布者信息,Mac用户需拖入应用程序文件夹。登录支持微信扫码或手机号,公司电脑安装需IT授权。更新通过个人中心检查,遇到安装包损坏、登录失败或文件读写问题时,建议重新下载、检查网络/权限或联系官方支持。重要文件建议定期备份,避免直接操作原文件。(149字)

企鹅码农的专属播客,分享10多年的实战案例和经验解读,包含YOLO、RT-DETR、AI等各个工作领域。 1825

CodeForces - 1004B - Sonya 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 fl...

QDU_ZXF的博客 3053

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

X - Sonya and Exhibition 思维题 wdnmd

传送门 思路:我服了。 因为题目要求是价值最大,所以在任意一个区间,只要是百合和玫瑰相等或相差为1即为相乘数量最多,所以区间完全是多余的!只要我们让它交错分布即可。 /** * From: * Qingdao Agricultural University * Created by XiangwangAcmer * Date : 2019-11-08-08.11.30 * Talk is chea...

weixin_43960370的博客 355

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

B - Sonya and Exhibition-思维题

只要保证间隔着放0.1两种花就能得到。 任意两个区间内的乘积最大。   #include&lt;bits/stdc++.h&gt; using namespace std; int main() { int n,m,u,v; cin&gt;&gt;n&gt;&gt;m; while(m--) { cin&gt;&gt;u&gt;&gt;v; ...

BePosit的博客 240

Codeforces Round #495 (Div. 2) B. Sonya and Exhibition 思维

题目链接 题意: 给你n朵花,让他排成一排,每个位置可以是玫瑰或者百合花。然后给m个人,每个人会参观 l 到 r 的区间的花。这个人的喜爱值为这段区间的玫瑰数乘以百合数。问怎么排列,才能使得这m个的喜爱值之和最大。 思路: 这m个人条件根本是无用的。。。。。。不得不说,这个迷惑条件很优秀。 最基本的我们可以想到,可以使得每一个区间的玫瑰数等于百合数 或者 玫瑰数与百合数的差值为一。为什么呢?3...

give it a try 145

1004B. Sonya and Exhibition(思维+简单数学)

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 r...

码农的一亩三分地 365

C. Sonya and Robots

C. Sonya and Robotstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputSince Sonya is interested in robotics too, she decided to construct robots that ...

Become hunger become strong 819

Codeforces Round #495 (Div. 2) B. Sonya and Exhibition(s)si'we思维

题意 给你一个n,m,之后给你m个区间,问你怎样构建这样一个长度为n的字符串让这m个区间的中0的个数*1的个数最大 思路 我们直接输出01010101就好了,因为这样无论他在那个区间,我们0和1的个数总是最大的 代码 #include &lt;bits/stdc++.h&gt; using namespace std; int vis[111]; int ans[111]; int ma...

wjmwsgj的博客 241

Codeforces Round #495 (Div. 2) 解题报告 B. Sonya and Exhibition 数学思维

http://codeforces.com/contest/1004/problem/B解题思路:1.样例什么的都是误导人的骗子2.一开始被样例误导,写了一大坨奇怪的东西,还拼命想打补丁。。(傻子直视感)3.重审一下题目要求就很明确了:要求每个区间的0/1个数尽可能相等4.那直接01串这样输出就好了(A过去后看后台样例,感受到了出题人深邃的恶意)#include &lt;iostream&gt; ...

三生锁链 189

cordforce 495 补题 <未完>

题目链接: http://codeforces.com/contest/1004/my A. Sonya and Hotels 分类讨论 看第一个样例解释的时候没看到后面第二行还有一个19,想了半天为啥19不算 题意大致是选定一个位置,使得其到达原本那些位置的距离最小的为d 此处应注意,最小为d意味着不能距离小于d 所以可能的住所有三种情况, 1. 两个城市距离小于2d, 那么无法...

weixin_30533797的博客 136

Codeforces Round #495 (Div. 2) B

题目链接:http://codeforces.com/contest/1004/problem/B B. Sonya and Exhibition time limit per test 1 second memory limit per test 256 megabytes input standard input output standard outpu...

weixin_30241919的博客 96

cf B. Sonya and Exhibition

题目网址点击打开链接题目大意就是给你一个长度为n的区间放花(玫瑰或百合),然后问你怎么放可以令给定的m个区间的值的和最大,然后打印任意一个放法。区间的值就是该区间玫瑰花数量*百合数量。我一开始是用dfs把每一种放法都求出来,得到令给定的m个区间的值的和最大的放法。但是ac不了,复杂度太高了超时了。后来看了大佬的博客才知道,我们要打印的花的序列只于n有关,那些要求是用来迷惑的。题目要求要让m个区间的...

SEIZE THE DAY 520
上一篇: Least common multiple (数论+完全背包)
下一篇: Binary String Constructing(思维+构造)
Guuuuuu老师儿
博客等级 码龄9年 259粉丝 718原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值