Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<cstdio>
- #include<cstring>
- #include<set>
- #include<algorithm>
- using namespace std;
- int s,br,z,sol,sol1,x,y,n,p[1000100],t[1000];
- int main(){
- scanf("%d",&s);
- for(int k = 0;k < s; k++){
- sol = sol1 = 0;
- n = br = 0;
- scanf("%d",&z);
- for(int j = 0;j < z; j++){
- scanf("%d %d",&x ,&y);
- t[br] = x;
- br++;
- t[br] = y;
- br++;
- p[x] = 1;
- p[y] = -1;
- }
- sort(t,t + br);
- for(int i = 0;i <= z * 2 + 100;i++){
- sol1 = sol1 + p[t[i]];
- sol = max(sol1,sol);
- }
- printf("%d\n",sol);
- memset(p,0,sizeof p);
- memset(t,0,sizeof t);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement