`
kmplayer
  • 浏览: 508744 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Two Professors

阅读更多
1,题目大意:
给n条线段,要求划分成尽可能少的子集,使得在同一个子集中的线段两两不重叠.
同时限定线段1和线段2不能在同一子集中.

2,问题分析:
(1)
记每条线段为[Li,Ri], 每个子集的最右端为Bi. 
记线段1和2中,L较小的那个为X,另一个为Y.
(2)
如果没有那个限定,容易想到贪心的方法:
将所有线段按L从小到大排序.然后依次处理线段k,如果当前存在某个集合的Bi<=Lk,就将Lk加入此集合中,并更新Bi=Rk.否则新开一个集合放入k.模拟这个过程,最后的集合数就是答案.用堆维护已有集合的信息,时间复杂度是O(nlgn).
(3)
有了限制条件后,原方法不适用了,因为在X与Y之间处理的线段,对B有后效性.这会使得单纯按照刚才的方法随意贪心,可能轮到Y时,只有X所在集合的Bi<=LY,迫使必须开新集合.但实际上,有可能可以通过调整X与Y之间的线段排列结构,使Y避开X.
问题关键就是如何判断能否调整(并不用关心详细的调整步骤).
当一条线段(P)面临多个可插入的集合时,之前的方法是随意选一个,而不合适的决策正在此产生.下面构造一个情景:
假设P可以在两个集合s,t中选择,而X在s中.
现在P选择加入t.
接下来按部就班地处理.
轮到Y选时,它只能选择加入s,或者开新的集合.
这时候,我们能得知,如果当初P选择的是s,紧随其后的其它选择也相应地对调,那么Y此时肯定面临的是只能加入t,或者开新的集合.
这样Y当然直接加入t就行了.
这说明,只要存在一个这样的P,当Y遭遇X时,肯定存在形状对称的另一个局面使Y避开X,而P就是关键先生.
(4)
所以只需稍微改造之前的算法,在处理X与Y之间的线段时,判断并记录下是否出现过可选局面.这样就能正确处理Y遭遇X的情形了.
其它情形时策略不变(可以证明这样的解是最优的).
题目连接:
http://acm.scs.bupt.cn/onlinejudge/showproblem.php?problem_id=1517
分享到:
评论

相关推荐

    英文原版-Operating System Concepts Essentials 2nd Edition

    This second edition of the Essentials version is based on the recent...professors who want a shorter text and do not cover all the topics in the ninth edition.The new second edition of Essentials will be...

    Quantum Mechanics, Vol. 2

    Applications follow, starting with the simplest ones (two-level systems, the harmonic oscillator, etc.), and becoming gradually more complicated (the hydrogen atom, approximation methods, etc.)....

    Artificial Neural Networks - Industrial and Control Engineering Applications

    Artificial neural networks may probably be the single most successful technology in the last two decades which has been widely used in a large variety of applications. The purpose of this book is to ...

    考研复试英语口语自我介绍经典范文.docx

    例如:“Good morning, my dear teachers, my dear professors. I am very glad to be here for your interview. My name is Song Yonghao, I am 22 years old...” 总的来说,一个成功的英语自我介绍应该简洁明了...

    Dictionary of Pure and Applied Physics

    published by CRC Press LLC, the other two being the Dictionary of Material Science and High En- ergy Physics and Dictionary of Geophysics, Astrophysics and Astronomy. Each of these dictionaries is ...

    中国考研英语的自我介绍

    1. **开场问候**:例如:“Good morning/afternoon, dear teachers/professors. I am very glad to be here for this interview.” 2. **基本信息介绍**:如姓名、年龄、毕业院校等。 3. **教育背景**:详细介绍自己...

    研究生面试英文自我介绍

    - 示例:"Good morning/afternoon, Professors. It’s a fine day today, and I’m very pleased to meet you here." - **个人基本信息**:接着介绍自己的姓名、年龄、出生地等基本信息。 - 示例:"My name is ***...

    研究生复试英语自我介绍word模板.doc

    一个好的开场白能够迅速吸引考官的注意力,比如:“Good morning, respected professors. I am deeply honored to have this opportunity to introduce myself in this prestigious institution.” 2. 基本信息: ...

    PHP.and.Algorithmic.Thinking.for.the.Complete.Beginner.1503015

    this book is ideal for students, teachers, professors, novices or average programmers, or for anyone who wants to start learning or teaching computer programming using the proper conventions and ...

    英语自我介绍

    首先,自我介绍通常以礼貌的问候开始,例如“Good afternoon, my dear professors”。这样的开场白既显得尊重,又能迅速建立良好的第一印象。 接下来是个人基本信息的介绍:“My name is XXX, 23 years old. I come...

    研究生复试经典自我介绍3篇必背

    - **开场白**:“Good morning, dear teachers and professors. I am very glad to be here for this interview.” 在正式开始自我介绍之前,礼貌地向考官们问好是非常必要的。这不仅能够营造一个良好的第一印象,还...

    外资企业面试HR提问大全.doc

    Your professors?"):通过他人的评价来评估应聘者的性格特点和工作态度。 5. **自我展示**(如"What else should I know about you?"):提供一个机会让应聘者展示自己的独特性,包括个人优势和兴趣爱好。 6. **...

    2019高考英语新课件二轮练习精品测试卷2unit2.doc

    4. 公共交通服务:"A new regular bus service to Tianjin Airport started to operate two months ago." 表示开通了一条定期的公交线路,"regular" 指定期、定时。 5. 基础、依据:"We drew this conclusion on ...

    人力资源部招聘面试百宝箱87.doc

    - “What two or three things are important to you in your new position?”:考察价值观与职位的契合度。 5. **离职原因与忠诚度** - “Why do you want to leave your current position?”:理解应聘者的离职...

    Lecture_1_Introduction.pdf

    The lecture is part of the course CS101, taught by Professors Dengji Zhao and Yuyao Zhang. #### What Will We Learn from This Course? The course aims to provide a comprehensive understanding of ...

    英语-外企面试大全(1).doc

    Your professors?) - 这是评估你的个人特质和人际交往能力的机会,可以提及团队合作、沟通技巧和专业素养等正面评价。 5. **我还需要知道关于你的哪些事情?**(What else should I know about you?) - 这是...

    CS245 第三次作业

    #### (g) One can travel between any two Canadian cities by airplane, train, or bus. 这个句子的谓词逻辑形式为:∀x∀y(P(x)∧P(y)→(Q(x,y)∨R(x,y)∨S(x,y))),这里P(x)代表“x是加拿大城市”,Q、R、S分别...

    博士面试英语自我介绍范例.docx

    6. **参与项目与荣誉**:列举参与的科研项目,如“participating in the research of two projects funded by National Natural Science Foundation”,并提及获得的奖励,如“rewarded the Excellent Prize”。...

    外企面试求职大全(详细)

    Your professors?** - **考察点**:评估应聘者的个性特点和社会评价。 - **应对策略**:选择正面积极的形容词,例如“可靠”、“勤奋”等,并提供具体例子加以佐证。 **5. What else should I know about you?** -...

Global site tag (gtag.js) - Google Analytics