Gaming Cafe- Editorial || GAMCAF07

PROBLEM LINK: Gaming Cafe | CodeChef

Problem Code: Gaming Cafe | CodeChef

Practice: Practice | CodeChef

Contest : Campus Code August Edition Coding Competition | CodeChef

Author: Codechef Adgitm Chapter : https://www.codechef.com/users/test_account_9
Tester: Codechef Adgitm Chapter : https://www.codechef.com/users/test_account_9
Editorialist: Codechef Adgitm Chapter : https://www.codechef.com/users/test_account_9

DIFFICULTY:

Easy-Med

PROBLEM:

You run a Gaming cafe where people come and use your Computers to play Games, given arrival and departure time of all players in your cafe find out the minimum number of Computers you need to setup so that no player has to wait for a Computer to be free.

EXPLANATION:
Find minimum number computers needed to setup.

SOLUTION:
C++:

#include <bits/stdc++.h>
using namespace std;

int main() {
// your code goes here
int n,max=0,j,a,d;
cin>>n;
int i,time[3601];
for(i=0;i<3601;i++){
time[i] = 0;
}

for(i=0;i<n;i++){
    cin>>a>>d;
    for(j=a;j<=d;j++){
        time[j] +=1;
    }
}
for(i=0;i<3601;i++){
    //cout<<time[i]<<" ";
    if(time[i] > max){
        max = time[i];
    }
}
cout<<max;
return 0;

}