#include using namespace std; typedef long long int ll; #define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; pair < pair ,string > dp[205][205]; int sy,sx,ey,ex; bool vis[205][205]; int row[6] = {-2,-2,0,2,2,0}; int col[6] = {-1,1,2,1,-1,-2}; int revrow[6] = {2,2,0,-2,-2,0}; int revcol[6] = {1,-1,-2,-1,1,2}; string help(int i) { if (i==0) return "UL"; else if (i==1) return "UR"; else if (i==2) return "R"; else if (i==3) return "LR"; else if (i==4) return "LL"; else return "L"; } bool isSafe(int i,int j) { if (i >=0 && j >= 0 && i < n && j < n && !vis[i][j]) return true; return false; } void func() { queue < pair < pair , int > > q; vector ans; vis[sy][sx] = true; pair < pair < int,int >, int > p = make_pair( make_pair(sy,sx), 0 ); q.push(p); int minDist = INT_MAX; while (!q.empty()) { p = q.front(); q.pop(); int i = p.first.first, j = p.first.second, dist = p.second; if (i == ey && j == ex) { minDist = dist; break; } for (int x = 0; x<6 ;x++) { if ( isSafe(i + row[x],j + col[x]) ) { dp[i+row[x]][j+col[x]] = make_pair( make_pair(i,j), help(x) ); //cout<= 0) { ans.push_back( dp[i][j].second ); //cout<>n; cin>>sy>>sx>>ey>>ex; func(); return 0; }