#include using namespace std; #define fi first #define se second int n,m; int blue[24]; int red[24]; int bc=0,rc=0; char ans[24][24]; void out(){ for(int i=0; i> n; for(int i=0; i> c; if(c=='F'){ blue[i]|=1<ban || d>ban || min(c,d)*2>=ban) continue; //cout << "Hi " << i << endl; bool ok_red=true; bool ok_blue=true; for(int k=0; k>k)&1){ if((blue[k]&(i)) || (red[k]&j)) ok_blue=false; if((blue[k]&(j)) || (red[k]&i)) ok_red=false; } else{ if((blue[k]&(i)) || (red[k]&j)) ok_red=false; if((blue[k]&(j)) || (red[k]&i)) ok_blue=false; } } if(ok_red){ for(int c=0; c>c)&1) != ((i>>d)&1)) ans[c][d]='S'; else ans[c][d]='F'; } } out();return 0; } if(ok_blue){ for(int c=0; c>c)&1) != ((i>>d)&1)) ans[c][d]='F'; else ans[c][d]='S'; } } out();return 0; } } for(int i=0; i<(1<=ban) continue; if(n-c>ban) continue; bool ok=true; bool ok_red=(rc<=n/4); bool ok_blue=(bc<=n/4); for(int k=0; k>k)&1){ if(red[k]) ok_blue=false; if(blue[k]) ok_red=false; } } if(ok_red){ for(int c=0; c>c)&1) || ((i>>d)&1)) ans[c][d]='S'; else if((red[c]>>d)&1) ans[c][d]='S'; else ans[c][d]='F'; } } out();return 0; } if(ok_blue){ for(int c=0; c>c)&1) || ((i>>d)&1)) ans[c][d]='F'; else if((blue[c]>>d)&1) ans[c][d]='F'; else ans[c][d]='S'; } } out();return 0; } } }