2894. Meetings
来源:互联网 发布:sql 存储过程 编辑:程序博客网 时间:2024/06/07 16:41
There are several meeting rooms in Tianjin University. Since there are a lot of new students registering at the beginning of the term, the directors of school have scheduled many meetings to discuss upcoming issues. Suppose there are N meetings in total. The i-th meeting starts at time si and ends at time ei. Consider the j-th meeting can be held immediately after the i-th meeting in the same meeting room. Then we must have sj ≥ ei. In order to minimize usage of resources, the directors of school has asked you to write a program that calculates the minimum number of meeting rooms required for the whole meetings.
Input
There are several test cases in the input data. The first line contains the number of test cases. The first line contains a positive integer N (1 ≤ N ≤ 105) denoting the number of meetings. Then there are N lines, and the i-th line contains si and ei, (1 ≤ si < ei ≤ 109) denoting the start time and the end time of i-th meeting.
Output
Output the minimum number of meeting rooms required for the whole meetings.
Sample Input
221 33 533 51 44 5
Sample Output
12
Hint: In the second sample input, we can arrange the meeting like this to minimize the number of meeting rooms required:
Room A: (1, 4) (4, 5)
Room B: (3, 5)
#include<iostream>#include<algorithm>using namespace std;const int num=100000;int a[num],b[num];int main(){int t,n;cin>>t;while(t--){cin>>n;for(int i=0;i<n;i++){cin>>a[i]>>b[i];}sort(a,a+n);sort(b,b+n);int i=0,j=0;int ans=0;while(i<n){if(a[i]>=b[j]){i++;j++;}else{i++;ans++;}}cout<<ans<<endl;}return 0;}
- 2894. Meetings
- Meetings
- Meetings
- TOJ 2894. Meetings(贪心基础)
- toj2894 Meetings
- WebEx Web Meetings For Dummies
- Meetings Don’t Write Code
- Language Used to Participated in Meetings
- Methods, Not Methodology (4): Effective Meetings
- Effectively Taking Notes in meetings or classes or ..
- 新会议工具Skype Meetings,专为小型企业定制
- It's Not Just Standing Up: Patterns of Daily Stand-up Meetings
- 黑马程序员——Java泛型知识点
- CF 题目集锦 PART 1 #138 div 1 A
- BZOJ 3295 动态逆序对 CDQ分治
- LightOj 1110 An Easy LCS
- Unity中PlayerPrefs.DeleteAll()无法清除数据的问题
- 2894. Meetings
- 优美地启动多线程[Python]
- 多校比赛第十场
- yii页面的 表单元素
- ios objective c 的基本知识
- Leetcode【33】:Search for a Range
- github学习(pro git)---第二章
- ios 表情各大编码对照表
- 咖啡豆(JavaBean)•常用JavaBean