Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- struct Job {
- int startTime;
- int endTime;
- };
- const int N=10e5;
- int main() {
- int n;
- cin>>n;
- Job jobs[n];
- int time[N]={0};
- for(int i=0;i<n;i++) {
- cin>>jobs[i].startTime>>jobs[i].endTime;
- time[jobs[i].startTime]+=1;
- time[jobs[i].endTime]-=1;
- }
- int maxConcurrentJobs=time[0];
- for(int i=1;i<N;i++) {
- time[i]+=time[i-1];
- maxConcurrentJobs=max(maxConcurrentJobs,time[i]);
- }
- cout<<maxConcurrentJobs<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement