#include #include #include #include #include using namespace std; class Board{ int8_t *bd; inline int8_t& operator[](int i){return bd[i];} inline int8_t& at(int x,int y,bool tr=false){ if(tr)return bd[S*x+y]; else return bd[S*y+x]; } string row(int i,bool tr){return (tr?"column ":"row ")+to_string(i+1);} string column(int i,bool tr){return (tr?"row ":"column ")+to_string(i+1);} string pos(int x,int y,bool tr){return "("+to_string(tr?y+1:x+1)+","+to_string(tr?x+1:y+1)+")";} bool solvefullrows(bool tr){ bool changed=false; for(int y=0;y "< 1"; } cerr< 0"; } cerr< "< "< "< "<0&&x1&&at(x-2,y,tr)!=-1&&at(x-2,y,tr)==at(x-1,y,tr))opp=at(x-1,y,tr); else if(x "<=3){ cerr<<"Trit verification failure at "<>(istream &is,Board &bd); friend ostream& operator<<(ostream &os,const Board &bd); }; istream& operator>>(istream &is,Board &bd){ char c; for(int i=0;i>c; if(c=='0')bd[i]=0; else if(c=='1')bd[i]=1; else if(c=='.'||c=='_')bd[i]=-1; else { cerr<<"Invalid char inputted: '"<>S; Board bd(S); cin>>bd; cerr<