Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<cstdio>
- #include<cstdlib>
- #include<cmath>
- #include<cctype>
- #include<cstring>
- #include<iostream>
- #include<string>
- #include<algorithm>
- #include<vector>
- #include<queue>
- #include<stack>
- #include<set>
- #include<map>
- #define mset(a,v) memset(a,v,sizeof(a))
- #define read freopen("input.c","r",stdin)
- #define write freopen("output.txt","w",stdout)
- #define ll long long
- #define pii pair<int,int>
- #define Mx 100
- #define total 7
- #define Inf 2147364748
- using namespace std;
- struct abc
- {
- int value , mark ; // mark 0 for start point , 1 for end
- } Inp [ Mx + Mx ] ;
- bool cmp ( abc A , abc B )
- {
- if ( A.value == B.value ) return A.mark < B.mark ; // start mark age thakbe
- return A.value < B.value ;
- }
- int main()
- {
- int n , i , x , y , idx = 0;
- cin >> n ;
- for ( i = 0 ; i < n ; i++ )
- {
- cin >> x >> y ;
- Inp[idx].value = x ;
- Inp[idx++].mark = 0 ;
- Inp[idx].value = y ;
- Inp[idx++].mark = 1 ;
- }
- sort(Inp , Inp+idx , cmp );
- /*
- cout<<endl<<endl;
- for(i = 0 ; i<idx ; i++){
- cout<<Inp[i].value<<" "<<Inp[i].mark<<endl;
- }
- */
- int Ans = -Inf ;
- int cur = 0 ; // eita count korbe koyta program ekhon run korche
- for ( i = 0 ; i < idx ; i++ )
- {
- if( Inp[i].mark == 0 ) // mane notun program start hoiche
- cur++;
- else cur-- ; // program off hoiche
- Ans = max(Ans , cur );
- }
- cout<<Ans<<endl;
- return 0 ;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement