#include #include #include #include #include #include using namespace std; int main(int argc, char * * argv) { map stavy1; map stavy2; int x; int beg=0; for(int i=0;i<4;i++) { cin>>x; beg+=x; if(i<3) beg<<=8; } stavy1.insert({beg, 1.0}); vector prs(2); int pl=0; // 0 white, 1 black while(true) { // move for(auto && s: stavy1) { // if(s.second==0) continue; // WTF int stav=s.first; int x,y, x2, y2; if(pl==0) { x=(stav>>24)&255; y=(stav>>16)&255; x2=(stav>>8)&255; y2=(stav)&255; }else{ x2=(stav>>24)&255; y2=(stav>>16)&255; x=(stav>>8)&255; y=(stav)&255; } int no_news=0; set> tahy = { {-2, -1}, {-2, +1}, {+2, -1}, {+2, +1}, {-1, -2}, {-1, +2}, {+1, -2}, {+1, +2} }; for(auto && t: tahy) { int nx,ny; nx=x+t.first; ny=y+t.second; if(nx>=1 && nx<=8 && ny>=1 && ny<=8) no_news++; } for(auto && t: tahy) { int nx,ny; nx=x+t.first; ny=y+t.second; if(nx>=1 && nx<=8 && ny>=1 && ny<=8) { int newState=0; if(pl==0) { newState+=nx<<24; newState+=ny<<16; newState+=x2<<8; newState+=y2; }else{ newState+=x2<<24; newState+=y2<<16; newState+=nx<<8; newState+=ny; } //cout<