codeforces contest 785 b题

Anton需要在n个不同的时间段上象棋课,并在m个时间段上编程课。他想找到两者间隔最大的时间。输入包含每个课程的时间段,输出为最大间隔。解题策略是找出所有象棋课的最早结束时间和最晚开始时间,以及所有编程课的最晚开始时间和最早结束时间,然后找出最大间隔。
摘要由CSDN通过智能技术生成

B. Anton and Classes
time limit per test4 seconds
memory limit per test256 megabytes
inputstandard input
outputstandard output
Anton likes to play chess. Also he likes to do programming. No wonder that he decided to attend chess classes and programming classes.

Anton has n variants when he will attend chess classes, i-th variant is given by a period of time (l1, i, r1, i). Also he has m variants when he will attend programming classes, i-th variant is given by a period of time (l2, i, r2, i).

Anton needs to choose exactly one of n possible periods of time when he will attend chess classes and exactly one of m possible periods of time when he will attend programming classes. He wants to have a rest between classes, so from all the possible pairs of the periods he wants to choose the one where the distance between the periods is maximal.

The distance between periods (l1, r1) and (l2, r2) is the minimal possible distance betwee

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值