模拟
输入样例:
2
2
1 3
1 4
3
1 5
1 1
2 3
输出样例:
1 2
1 0 2
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
int t,n;
cin >> t;
while (t -- )
{
cin >> n;
int l,r,last=0;
while (n -- )
{
cin >> l >> r;
if(max(l,last)>r){
cout << 0 << ' ';
}else{
cout << max(l,last) << ' ';
last = max(l,last)+1;
}
}
cout << endl;
}
return 0;
}