编程介的小学生 2017-02-11 09:28 采纳率: 20.5%
浏览 815
已采纳

Happy Telephones

问题描述 :

In the land of Eden, all phone conversations are happy ones. People complaining on the phone are immediately put in jail. To enforce this law, the police taps all phone conversations.
The police wants to hire the approriate number of operators to listen to all conversations in a given period of time. Unfortunately, each of their operators can listen to one conversation only before needing a really long break to rest from the effort.
As a contractor of the police department, you have been asked to provide a program capable of determining the required number of operators. If the program does not work correctly, you will be put in jail as well, along with all the unhappy complainers. Do you really want to end up there?

输入:

Each test case starts with two integers denoting the number of phone calls N (1 <= N < 10 000) and the number of intervals M (1 <= M < 100). This is followed by N lines describing the telephone calls, each one consisting of four integers Source, Destination, Start and Duration. Source and Destination identify the pair of telephone numbers establishing the connection (0 <= Source, Destination <= 10 000 000). Start and Duration are the start time and duration of the call in seconds (1 <= Duration <= 10 000 and Start >= 0). You can safely assume that the sum of Start and Duration fits into a 32-bit signed integer.
Afterwards follow M lines containing the time intervals the police are interested in, each on described by two integers Start and Duration, in the same format and with the same meaning and constraints as those in the telephone calls. The last test case is represented by N = M = 0 and must not be processed.
输出:

Each test case starts with two integers denoting the number of phone calls N (1 <= N < 10 000) and the number of intervals M (1 <= M < 100). This is followed by N lines describing the telephone calls, each one consisting of four integers Source, Destination, Start and Duration. Source and Destination identify the pair of telephone numbers establishing the connection (0 <= Source, Destination <= 10 000 000). Start and Duration are the start time and duration of the call in seconds (1 <= Duration <= 10 000 and Start >= 0). You can safely assume that the sum of Start and Duration fits into a 32-bit signed integer.
Afterwards follow M lines containing the time intervals the police are interested in, each on described by two integers Start and Duration, in the same format and with the same meaning and constraints as those in the telephone calls. The last test case is represented by N = M = 0 and must not be processed.
样例输入:

3 2
3 4 2 5
1 2 0 10
6 5 5 8
0 6
8 2
1 2
8 9 0 10
9 1
10 1
0 0
样例输出:

3
2
1
0

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-02-15 15:02
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作