#include using namespace std; typedef pair ii; #define x first #define y second int A[] = {-2, -2, 0, 2, 2, 0}; int B[] = {-1, 1, 2, 1, -1, -2}; string accion[] = {"UL", "UR", "R", "LR", "LL", "L"}; void printShortestPath(int n, int ai, int bi, int af, int bf) { int tab[n][n]; int padre[n][n]; for(int i=0; i nnode; nnode.push(ii(ai, bi)); tab[ai][bi] = 0; while(!nnode.empty()) { int a = nnode.front().x; int b = nnode.front().y; nnode.pop(); for(int i=0; i<6; i++) { int I = a + A[i]; int J = b + B[i]; if(I>=0 && J>=0 && I camino; cout << tab[af][bf] << '\n'; int p = padre[af][bf]; while(p != -1) { camino.push(accion[p]); af -= A[p]; bf -= B[p]; p = padre[af][bf]; } cout << camino.top(); camino.pop(); while(!camino.empty()) { cout << ' ' << camino.top(); camino.pop(); } cout << '\n'; } } int main() { int n; cin >> n; int i_start; int j_start; int i_end; int j_end; cin >> i_start >> j_start >> i_end >> j_end; printShortestPath(n, i_start, j_start, i_end, j_end); return 0; }