#include #define ll long long #define inf 100000000 using namespace std; int n,is,ie,js,je,**dist; void fun(int x,int y){ if(x==is && y==js) return; if(x-2>=0 && y-1>=0 && dist[x-2][y-1]>dist[x][y]+1){ dist[x-2][y-1]=dist[x][y]+1; fun(x-2,y-1); } if(x-2>=0 && y+1dist[x][y]+1){ dist[x-2][y+1]=dist[x][y]+1; fun(x-2,y+1); } if(x+2=0 && dist[x+2][y-1]>dist[x][y]+1){ dist[x+2][y-1]=dist[x][y]+1; fun(x+2,y-1); } if(x+2dist[x][y]+1){ dist[x+2][y+1]=dist[x][y]+1; fun(x+2,y+1); } if(x>=0 && y-2>=0 && dist[x][y-2]>dist[x][y]+1){ dist[x][y-2]=dist[x][y]+1; fun(x,y-2); } if(x>=0 && y+2dist[x][y]+1){ dist[x][y+2]=dist[x][y]+1; fun(x,y+2); } } void printer(int x,int y){ if(x==ie && y==je) return; int mini=inf; if(x-2>=0 && y-1>=0) mini=min(mini,dist[x-2][y-1]); if(x-2>=0 && y+1=0) mini=min(mini,dist[x+2][y-1]); if(x+2=0 && y-2>=0) mini=min(mini,dist[x][y-2]); if(x>=0 && y+2=0 && y-1>=0 && mini==dist[x-2][y-1]){ cout<<"UL "; printer(x-2,y-1); return; } if(x-2>=0 && y+1=0 && y+2=0 && mini==dist[x+2][y-1]){ cout<<"LL "; printer(x+2,y-1); return; } if(x>=0 && y-2>=0 && mini==dist[x][y-2]){ cout<<"L "; printer(x,y-2); return; } } int main(){ cin>>n>>is>>js>>ie>>je; dist=(int**)calloc(n,sizeof(int*)); for(int i=0;i