Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <algorithm>
- #include <utility>
- using namespace std;
- int main()
- {
- int t,n,m,x,y;
- scanf("%d",&t);
- for(;t>0;t--)
- {
- scanf("%d",&n);
- pair<int, int> rightMost[n];
- int result[n];
- for(int i=0;i<n;i++)
- {
- rightMost[i].second=i;
- rightMost[i].first=-999999999;
- scanf("%d",&m);
- for(int j=0;j<m;j++)
- {
- scanf("%d%d",&x,&y);
- leftMost[i].first=max(rightMost[i].first,x);
- }
- }
- sort(rightMost,rightMost+n);
- for(int i=0;i<n;i++)
- result[rightMost[i].second]=i;
- for(int i=0;i<n;i++)
- printf("%d ",result[i]);
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement