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];
- struct ulaz{
- int q,tip;
- };
- bool cmp(ulaz a,ulaz b){
- if(a.x != b.x){
- return a.x < b.x
- }
- else{
- return 0;
- }
- }
- ulaz 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.q] = x;
- t[br.tip] = y;
- br++;
- p[x] = 1;
- p[y] = -1;
- }
- sort(t,t + br,cmp);
- for(int i = 0;i <= br;i++){
- sol1 = sol1 + p[t[i.x]];
- sol = max(sol1,sol);
- }
- printf("%d\n",sol);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement