Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- vector<pair<int, int>> boxes;
- int main()
- {
- int n,t;
- cin >> t;
- for(int i = 0; i < t; i++)
- {
- cin >> n;
- int c=0,pas=0,ok=0;
- boxes.clear();
- for(int j = 0; j < n; j++)
- {
- int x,y;
- cin >> x >> y;
- boxes.push_back({x, y});
- }
- sort(boxes.begin(), boxes.end());
- int xcutie=boxes[i].first, ycutie=boxes[i].second;
- do
- {
- if (xcutie)
- {
- xcutie++;
- c++;
- ok=1;
- }
- if (ycutie)
- {
- ycutie++;
- c++;
- ok=1;
- }
- pas++;
- }while (c==n || pas>=n*n);
- if (!ok)
- {
- cout<<"NO"<<endl;
- }
- else
- {
- cout<<"YES"<<endl;
- xcutie=boxes[i].first;
- ycutie=boxes[i].second;
- do
- {
- if (xcutie)
- {
- xcutie++;
- c++;
- cout<<"U";
- }
- if (ycutie)
- {
- ycutie++;
- c++;
- cout<<"R";
- }
- }while (c==n);
- }
- cout<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement