#include using namespace std; #define toDigit(c) (c-'0') #define __FastIO ios_base::sync_with_stdio(false); cin.tie(0) typedef long long int ll; pair>vis[205][205]; ll colNum[]={-1,1,2,1,-1,-2}; ll rowNum[]={-2,-2,0,2,2,0}; string dir[]={"UL","UR","R","LR","LL","L"}; map,string> mp; bool isValid(ll row,ll col,ll n) { return (row >= 0) && (row < n) && (col >= 0) && (col < n); } void bfs(ll sx,ll sy,ll ex,ll ey,ll n){ mp[make_pair(-1,-2)]="UL"; mp[make_pair(1,-2)]="UR"; mp[make_pair(2,0)]="R"; mp[make_pair(1,2)]="LR"; mp[make_pair(-1,2)]="LL"; mp[make_pair(-2,0)]="L"; for(ll i=0;i > q; q.push(make_pair(sx,sy)); vis[sx][sy].first=1; vis[sx][sy].second = make_pair(sx,sy); vector v; while(!q.empty()){ ll sz=q.size(); while(sz--){ pair p = q.front(); q.pop(); if(p.first==ex&&p.second==ey){ break; } for (int i = 0; i < 6; i++){ int row = p.first + rowNum[i]; int col = p.second + colNum[i]; if (isValid(row, col,n) &&!vis[row][col].first){ vis[row][col].first = vis[p.first][p.second].first+1; vis[row][col].second = make_pair(p.first,p.second); if(row==ex&&col==ey) break; q.push(make_pair(row, col)); // cout< v; while(sx!=ex||sy!=ey){ // cout<>n; ll sx,sy,ey,ex; cin>>sx>>sy>>ex>>ey; bfs(sx,sy,ex,ey,n); }