题目地址:http://codeforces.com/problemset/problem/350/C
/*
题意:机器人上下左右走路,把其他的机器人都干掉要几步,好吧我其实没读懂题目,
看着样例猜出来的,这题也蛮水的
模拟+贪心:sort一下,从最近的开始走
注意:坐标有一个为0的比普通的少一半的步骤,每次干掉一个要返回原来的位置
*/
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <map>
#include <set>
using namespace std; const int MAXN = 1e5 + ;
const int INF = 0x3f3f3f3f;
struct NODE
{
int x, y;
int ok;
int sum;
}node[MAXN]; bool cmp(NODE a, NODE b)
{
return a.sum < b.sum;
} int main(void) //Codeforces Round #203 (Div. 2) C. Bombs
{
//freopen ("F.in", "r", stdin); int n;
while (~scanf ("%d", &n))
{
int cnt = ;
for (int i=; i<=n; ++i)
{
scanf ("%d%d", &node[i].x, &node[i].y);
node[i].sum = abs (node[i].x) + abs (node[i].y);
//if (node[i].x < 0) node[i].x = -node[i].x;
//if (node[i].y < 0) node[i].y = -node[i].y;
if (node[i].x == || node[i].y == ) node[i].ok = , cnt++;
else node[i].ok = ;
}
sort (node+, node++n, cmp); printf ("%d\n", (n - cnt) * + * cnt);
for (int i=; i<=n; ++i)
{
if (node[i].ok == )
{
printf ("%d %d %c\n", , abs (node[i].x), (node[i]. x < ) ? 'L' : 'R');
printf ("%d %d %c\n", , abs (node[i].y), (node[i]. y < ) ? 'D' : 'U');
puts ("");
printf ("%d %d %c\n", , abs (node[i].x), (node[i]. x < ) ? 'R' : 'L');
printf ("%d %d %c\n", , abs (node[i].y), (node[i]. y < ) ? 'U' : 'D');
puts ("");
}
else
{
if (node[i].x == )
{
printf ("%d %d %c\n", , abs (node[i].y), (node[i]. y < ) ? 'D' : 'U');
puts ("");
printf ("%d %d %c\n", , abs (node[i].y), (node[i]. y < ) ? 'U' : 'D');
puts ("");
}
else
{
printf ("%d %d %c\n", , abs (node[i].x), (node[i]. x < ) ? 'L' : 'R');
puts ("");
printf ("%d %d %c\n", , abs (node[i].x), (node[i]. x < ) ? 'R' : 'L');
puts ("");
}
}
}
} return ;
}