using static System.Math; using System.Linq; using System.Collections.Generic; using System; public class P { public int id { get; set; } public int a { get; set; } public int b { get; set; } } public class Hello { static void Main() { var n = int.Parse(Console.ReadLine().Trim()); string[] line = Console.ReadLine().Trim().Split(' '); var a = Array.ConvertAll(line, int.Parse); line = Console.ReadLine().Trim().Split(' '); var b = Array.ConvertAll(line, int.Parse); getAns(n, a, b); } static void printAsb(List
asb) { var c = asb.Count(); for (int i = c - 1; i >= 0; i--) { var jmax = asb[i].b - asb[i].a; for (int j = 0; j < jmax; j++) Console.WriteLine("{0} R", asb[i].id); } } static void printAgb(List
agb) { var c = agb.Count(); for (int i = 0; i < c; i++) { var jmax = agb[i].a - agb[i].b; for (int j = 0; j < jmax; j++) Console.WriteLine("{0} L", agb[i].id); } } static void getAns(int n, int[] a, int[] b) { var asb = new List
(); var agb = new List
(); var s = 0L; for (int i = 0; i < n; i++) { s += Abs(a[i] - b[i]); if (a[i] < b[i]) asb.Add(new P { id = i + 1, a = a[i], b = b[i] }); else if (a[i] > b[i]) agb.Add(new P { id = i + 1, a = a[i], b = b[i] }); } Console.WriteLine(s); printAgb(agb); printAsb(asb); } }