1#include <cstdio>2#include <iostream>3 using namespacestd;4 intha[Ten][Ten],li[Ten][Ten],xi[Ten][Ten],a[Ten][Ten],bh[Ten][Ten],bl[Ten][Ten],kg;5 Charch[5];6 BOOLPanintXintYinti)7 {8 if(ha[x][i]| | li[y][i]| | xi[(x1)/3*3+ (Y1)/3][i])9 return 0;Ten if(Y-1)%3!=0&& (bh[x][y]^ (i>a[x][y-1]))) One return 0; A if(X-1)%3!=0&& (bl[x][y]^ (i>a[x-1][y] ))) - return 0; - return 1; the } - voidDfsintXinty) - { - //if (a[1][1]==4&&a[1][2]==9&&a[1][3]==1&&a[1][4]==7&&a[1][5]==3&&a[1 ][6]==6&&a[1][7]==5&&a[1][8]==2) + //{ - //printf (""); + //} A if(kg) at return; - if(y==Ten) - { -X + +; -y=1; - } in if(x==Ten) - { tokg=1; + for(intI=1; i<=9; i++) - { the for(intj=1; j<=9; j + +) * { $printf"%d", A[i][j]);Panax Notoginseng if(j!=9) -printf" "); the } +printf"\ n"); A } the return; + } - for(intI=1; i<=9; i++) $ if(Pan (x,y,i)) $ { -a[x][y]=i; -ha[x][i]=1; theli[y][i]=1; -xi[(x1)/3*3+ (Y1)/3][i]=1;WuyiDFS (x,y+1); theha[x][i]=0; -li[y][i]=0; Wuxi[(x1)/3*3+ (Y1)/3][i]=0; - } About } $ intMain () - { - for(intI=1; i<=9; i++) - { A for(intj=1;j<9; j + +) + if(j%3) the { -scanf"%s", ch); $ if(ch[0]=='<') thebh[i][j+1]=1; the Else thebh[i][j+1]=0; the } - if(i%3) in for(intj=1; j<=9; j + +) the { thescanf"%s", ch); About if(ch[0]=='^') thebl[i+1][j]=1; the Else thebl[i+1][j]=0; + } - } theDfs1,1);Bayi return 0; the}
A very disgusting search.
Bzoj 3109: [cqoi2013] New Sudoku