bzoj1501 [NOI2005]智慧珠游戏


搜索苟逼题系列。

暴力枚举每一种情况(包括旋转翻转全都考虑在内)然后码出代码。

(正解似乎不是这样子的)

那年好像还有平衡树苟逼题维护数列233333心疼2005noi

代码也就362行而已

PS.bzoj上的交题号是wfj_2333/滑稽

第五个点比较坑。。。我的方法是先搜出所有‘.'的联通块,有大小<3的就直接No Solution了,还有我瞎打乱了搜索顺序

(这个代码比我博客css还长、、、)

// It is made by XZZ
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cstring>
using namespace std;
#define rep(a,b,c) for(rg int a=b;a<=c;a++)
#define drep(a,b,c) for(rg int a=b;a>=c;a--)
#define erep(a,b) for(rg int a=fir[b];a;a=nxt[a])
#define il inline
#define rg register
#define vd void
#define ok =='.'
#define st =ch
#define fr ='.'
#define can(a) (yes[a])
#define disable(a) yes[a]=0
#define able(a) yes[a]=1
#define nxt x,y+1
typedef long long ll;
il int gi(){
rg int x=0;bool flg=0;rg char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')flg=1;ch=getchar();}
while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
return flg?-x:x;
}
const int n=10,m=12;
char s[233][233];
bool yes[233];
bool vis[20][20];
il int dfs(int x,int y){
if(vis[x][y])return 0;
vis[x][y]=1;
if(s[x][y]!='.')return 0;
return 1+dfs(x+1,y)+dfs(x-1,y)+dfs(x,y+1)+dfs(x,y-1);
}
il vd Init(){
memset(s,'X',sizeof s);
rep(i,1,n)scanf("%s",s[i]+1);
rep(i,0,n+1)s[i][0]='X';
rep(i,0,n+1)s[i][i+1]='X';
rep(i,0,n+1)s[n+1][i]='X';
rep(i,'A','L')yes[i]=1;
rep(i,1,n)rep(j,1,i)if(!(s[i][j]ok))yes[s[i][j]]=0;
rep(i,1,n)rep(j,1,i)if(s[i][j]ok&&!vis[i][j]&&dfs(i,j)<3){puts("No solution");exit(0);}
}
il vd Dfs(int x,int y){
if(x==n+1){
rep(i,1,n){
rep(j,1,i)putchar(s[i][j]);
puts("");
}exit(0);
}
if(y==x+1){Dfs(x+1,1);return;}
if(!(s[x][y]ok)){Dfs(nxt);return;}
char ch;
ch='B';
if(can(ch)){
disable(ch);s[x][y]st;
if(s[x+1][y]ok&&s[x+2][y]ok&&s[x+3][y]ok){
s[x+1][y]st,s[x+2][y]st,s[x+3][y]st,Dfs(nxt);
s[x+1][y]fr,s[x+2][y]fr,s[x+3][y]fr;
}
if(s[x][y+1]ok&&s[x][y+2]ok&&s[x][y+3]ok){
s[x][y+1]st,s[x][y+2]st,s[x][y+3]st,Dfs(nxt);
s[x][y+1]fr,s[x][y+2]fr,s[x][y+3]fr;
}
s[x][y]fr;able(ch);
}
ch='C';
if(can(ch)){
disable(ch);s[x][y]st;
if(s[x+1][y]ok&&s[x+2][y]ok&&s[x][y+1]ok){
s[x+1][y]st,s[x+2][y]st,s[x][y+1]st,Dfs(nxt);
s[x+1][y]fr,s[x+2][y]fr,s[x][y+1]fr;
}
if(s[x+1][y]ok&&s[x+2][y]ok&&s[x+2][y+1]ok){
s[x+1][y]st,s[x+2][y]st,s[x+2][y+1]st,Dfs(nxt);
s[x+1][y]fr,s[x+2][y]fr,s[x+2][y+1]fr;
}
if(s[x][y+1]ok&&s[x][y+2]ok&&s[x+1][y]ok){
s[x][y+1]st,s[x][y+2]st,s[x+1][y]st,Dfs(nxt);
s[x][y+1]fr,s[x][y+2]fr,s[x+1][y]fr;
}
if(s[x][y+1]ok&&s[x][y+2]ok&&s[x+1][y+2]ok){
s[x][y+1]st,s[x][y+2]st,s[x+1][y+2]st,Dfs(nxt);
s[x][y+1]fr,s[x][y+2]fr,s[x+1][y+2]fr;
}
if(s[x][y+1]ok&&s[x+1][y+1]ok&&s[x+2][y+1]ok){
s[x][y+1]st,s[x+1][y+1]st,s[x+2][y+1]st,Dfs(nxt);
s[x][y+1]fr,s[x+1][y+1]fr,s[x+2][y+1]fr;
}
if(s[x+1][y]ok&&s[x+2][y]ok&&s[x+2][y-1]ok){
s[x+1][y]st,s[x+2][y]st,s[x+2][y-1]st,Dfs(nxt);
s[x+1][y]fr,s[x+2][y]fr,s[x+2][y-1]fr;
}
if(y>2&&s[x+1][y]ok&&s[x+1][y-1]ok&&s[x+1][y-2]ok){
s[x+1][y]st,s[x+1][y-1]st,s[x+1][y-2]st,Dfs(nxt);
s[x+1][y]fr,s[x+1][y-1]fr,s[x+1][y-2]fr;
}
s[x][y]fr;able(ch);
}
ch='D';
if(can(ch)){
disable(ch);s[x][y]st;
if(s[x+1][y]ok&&s[x+1][y+1]ok&&s[x][y+1]ok){
s[x+1][y]st,s[x+1][y+1]st,s[x][y+1]st,Dfs(nxt);
s[x+1][y]fr,s[x+1][y+1]fr,s[x][y+1]fr;
}
s[x][y]fr;able(ch);
}
ch='E';
if(can(ch)){
disable(ch);s[x][y]st;
if(s[x+1][y]ok&&s[x+2][y]ok&&s[x][y+1]ok&&s[x][y+2]ok){
s[x+1][y]st,s[x+2][y]st,s[x][y+1]st,s[x][y+2]st,Dfs(nxt);
s[x+1][y]fr,s[x+2][y]fr,s[x][y+1]fr,s[x][y+2]fr;
}
if(s[x+1][y]ok&&s[x+2][y]ok&&s[x+2][y+1]ok&&s[x+2][y+2]ok){
s[x+1][y]st,s[x+2][y]st,s[x+2][y+1]st,s[x+2][y+2]st,Dfs(nxt);
s[x+1][y]fr,s[x+2][y]fr,s[x+2][y+1]fr,s[x+2][y+2]fr;
}
if(s[x+1][y+2]ok&&s[x+2][y+2]ok&&s[x][y+1]ok&&s[x][y+2]ok){
s[x+1][y+2]st,s[x+2][y+2]st,s[x][y+1]st,s[x][y+2]st,Dfs(nxt);
s[x+1][y+2]fr,s[x+2][y+2]fr,s[x][y+1]fr,s[x][y+2]fr;
}
if(s[x+1][y]ok&&s[x+2][y]ok&&s[x+2][y-1]ok&&s[x+2][y-2]ok){
s[x+1][y]st,s[x+2][y]st,s[x+2][y-1]st,s[x+2][y-2]st,Dfs(nxt);
s[x+1][y]fr,s[x+2][y]fr,s[x+2][y-1]fr,s[x+2][y-2]fr;
}
s[x][y]fr;able(ch);
}
ch='G';
if(can(ch)){
disable(ch);s[x][y]st;
if(s[x+1][y]ok&&s[x][y+1]ok&&s[x][y+2]ok&&s[x+1][y+2]ok){
s[x+1][y]st,s[x][y+1]st,s[x][y+2]st,s[x+1][y+2]st,Dfs(nxt);
s[x+1][y]fr,s[x][y+1]fr,s[x][y+2]fr,s[x+1][y+2]fr;
}
if(s[x+1][y]ok&&s[x+1][y+1]ok&&s[x][y+2]ok&&s[x+1][y+2]ok){
s[x+1][y]st,s[x+1][y+1]st,s[x][y+2]st,s[x+1][y+2]st,Dfs(nxt);
s[x+1][y]fr,s[x+1][y+1]fr,s[x][y+2]fr,s[x+1][y+2]fr;
}
if(s[x][y+1]ok&&s[x+1][y+1]ok&&s[x+2][y+1]ok&&s[x+2][y]ok){
s[x][y+1]st,s[x+1][y+1]st,s[x+2][y+1]st,s[x+2][y]st,Dfs(nxt);
s[x][y+1]fr,s[x+1][y+1]fr,s[x+2][y+1]fr,s[x+2][y]fr;
}
if(s[x][y+1]ok&&s[x+1][y]ok&&s[x+2][y+1]ok&&s[x+2][y]ok){
s[x][y+1]st,s[x+1][y]st,s[x+2][y+1]st,s[x+2][y]st,Dfs(nxt);
s[x][y+1]fr,s[x+1][y]fr,s[x+2][y+1]fr,s[x+2][y]fr;
}
s[x][y]fr;able(ch);
}
ch='H';
if(can(ch)){
disable(ch);s[x][y]st;
if(s[x+1][y]ok&&s[x+1][y+1]ok&&s[x][y+1]ok&&s[x][y+2]ok){
s[x+1][y]st,s[x+1][y+1]st,s[x][y+1]st,s[x][y+2]st,Dfs(nxt);
s[x+1][y]fr,s[x+1][y+1]fr,s[x][y+1]fr,s[x][y+2]fr;
}
if(s[x+1][y]ok&&s[x+1][y+1]ok&&s[x][y+1]ok&&s[x+1][y+2]ok){
s[x+1][y]st,s[x+1][y+1]st,s[x][y+1]st,s[x+1][y+2]st,Dfs(nxt);
s[x+1][y]fr,s[x+1][y+1]fr,s[x][y+1]fr,s[x+1][y+2]fr;
}
if(s[x+1][y]ok&&s[x+1][y+1]ok&&s[x][y+1]ok&&s[x+2][y]ok){
s[x+1][y]st,s[x+1][y+1]st,s[x][y+1]st,s[x+2][y]st,Dfs(nxt);
s[x+1][y]fr,s[x+1][y+1]fr,s[x][y+1]fr,s[x+2][y]fr;
}
if(s[x+1][y]ok&&s[x+1][y+1]ok&&s[x][y+1]ok&&s[x+2][y+1]ok){
s[x+1][y]st,s[x+1][y+1]st,s[x][y+1]st,s[x+2][y+1]st,Dfs(nxt);
s[x+1][y]fr,s[x+1][y+1]fr,s[x][y+1]fr,s[x+2][y+1]fr;
}
if(s[x+1][y]ok&&s[x+1][y+1]ok&&s[x][y+1]ok&&s[x+1][y-1]ok){
s[x+1][y]st,s[x+1][y+1]st,s[x][y+1]st,s[x+1][y-1]st,Dfs(nxt);
s[x+1][y]fr,s[x+1][y+1]fr,s[x][y+1]fr,s[x+1][y-1]fr;
}
if(s[x+1][y]ok&&s[x+2][y]ok&&s[x+1][y+1]ok&&s[x+2][y+1]ok){
s[x+1][y]st,s[x+2][y]st,s[x+1][y+1]st,s[x+2][y+1]st,Dfs(nxt);
s[x+1][y]fr,s[x+2][y]fr,s[x+1][y+1]fr,s[x+2][y+1]fr;
}
if(s[x+1][y]ok&&s[x+2][y]ok&&s[x+1][y-1]ok&&s[x+2][y-1]ok){
s[x+1][y]st,s[x+2][y]st,s[x+1][y-1]st,s[x+2][y-1]st,Dfs(nxt);
s[x+1][y]fr,s[x+2][y]fr,s[x+1][y-1]fr,s[x+2][y-1]fr;
}
if(s[x][y+1]ok&&s[x+1][y+1]ok&&s[x][y+2]ok&&s[x+1][y+2]ok){
s[x][y+1]st,s[x+1][y+1]st,s[x][y+2]st,s[x+1][y+2]st,Dfs(nxt);
s[x][y+1]fr,s[x+1][y+1]fr,s[x][y+2]fr,s[x+1][y+2]fr;
}
s[x][y]fr;able(ch);
}
ch='A';
if(can(ch)){
disable(ch);s[x][y]st;
if(s[x+1][y]ok&&s[x][y+1]ok){
s[x+1][y]st,s[x][y+1]st,Dfs(nxt);
s[x+1][y]fr,s[x][y+1]fr;
}
if(s[x+1][y+1]ok&&s[x][y+1]ok){
s[x+1][y+1]st,s[x][y+1]st,Dfs(nxt);
s[x+1][y+1]fr,s[x][y+1]fr;
}
if(s[x+1][y]ok&&s[x+1][y+1]ok){
s[x+1][y]st,s[x+1][y+1]st,Dfs(nxt);
s[x+1][y]fr,s[x+1][y+1]fr;
}
if(s[x+1][y]ok&&s[x+1][y-1]ok){
s[x+1][y]st,s[x+1][y-1]st,Dfs(nxt);
s[x+1][y]fr,s[x+1][y-1]fr;
}
s[x][y]fr;able(ch);
}
ch='L';
if(can(ch)){
disable(ch);s[x][y]st;
if(s[x][y+1]ok&&s[x+1][y+1]ok&&s[x+2][y+1]ok&&s[x+3][y+1]ok){
s[x][y+1]st,s[x+1][y+1]st,s[x+2][y+1]st,s[x+3][y+1]st,Dfs(nxt);
s[x][y+1]fr,s[x+1][y+1]fr,s[x+2][y+1]fr,s[x+3][y+1]fr;
}
if(s[x][y+1]ok&&s[x][y+2]ok&&s[x][y+3]ok&&s[x+1][y+3]ok){
s[x][y+1]st,s[x][y+2]st,s[x][y+3]st,s[x+1][y+3]st,Dfs(nxt);
s[x][y+1]fr,s[x][y+2]fr,s[x][y+3]fr,s[x+1][y+3]fr;
}
if(s[x+1][y]ok&&s[x+2][y]ok&&s[x+3][y]ok&&s[x+3][y-1]ok){
s[x+1][y]st,s[x+2][y]st,s[x+3][y]st,s[x+3][y-1]st,Dfs(nxt);
s[x+1][y]fr,s[x+2][y]fr,s[x+3][y]fr,s[x+3][y-1]fr;
}
if(s[x+1][y]ok&&s[x+2][y]ok&&s[x+3][y]ok&&s[x+3][y+1]ok){
s[x+1][y]st,s[x+2][y]st,s[x+3][y]st,s[x+3][y+1]st,Dfs(nxt);
s[x+1][y]fr,s[x+2][y]fr,s[x+3][y]fr,s[x+3][y+1]fr;
}
if(s[x+1][y]ok&&s[x+1][y+1]ok&&s[x+1][y+2]ok&&s[x+1][y+3]ok){
s[x+1][y]st,s[x+1][y+1]st,s[x+1][y+2]st,s[x+1][y+3]st,Dfs(nxt);
s[x+1][y]fr,s[x+1][y+1]fr,s[x+1][y+2]fr,s[x+1][y+3]fr;
}
if(s[x+1][y]ok&&s[x+1][y-1]ok&&s[x+1][y-2]ok&&s[x+1][y-3]ok){
s[x+1][y]st,s[x+1][y-1]st,s[x+1][y-2]st,s[x+1][y-3]st,Dfs(nxt);
s[x+1][y]fr,s[x+1][y-1]fr,s[x+1][y-2]fr,s[x+1][y-3]fr;
}
if(s[x+1][y]ok&&s[x+2][y]ok&&s[x+3][y]ok&&s[x][y+1]ok){
s[x+1][y]st,s[x+2][y]st,s[x+3][y]st,s[x][y+1]st,Dfs(nxt);
s[x+1][y]fr,s[x+2][y]fr,s[x+3][y]fr,s[x][y+1]fr;
}
if(s[x+1][y]ok&&s[x][y+1]ok&&s[x][y+2]ok&&s[x][y+3]ok){
s[x+1][y]st,s[x][y+1]st,s[x][y+2]st,s[x][y+3]st,Dfs(nxt);
s[x+1][y]fr,s[x][y+1]fr,s[x][y+2]fr,s[x][y+3]fr;
}
s[x][y]fr;able(ch);
}
ch='I';
if(can(ch)){
disable(ch);s[x][y]st;
if(s[x][y+1]ok&&s[x][y+2]ok&&s[x+1][y+2]ok&&s[x+1][y+3]ok){
s[x][y+1]st,s[x][y+2]st,s[x+1][y+2]st,s[x+1][y+3]st,Dfs(nxt);
s[x][y+1]fr,s[x][y+2]fr,s[x+1][y+2]fr,s[x+1][y+3]fr;
}
if(s[x][y+1]ok&&s[x+1][y+1]ok&&s[x+1][y+2]ok&&s[x+1][y+3]ok){
s[x][y+1]st,s[x+1][y+1]st,s[x+1][y+2]st,s[x+1][y+3]st,Dfs(nxt);
s[x][y+1]fr,s[x+1][y+1]fr,s[x+1][y+2]fr,s[x+1][y+3]fr;
}
if(s[x+1][y]ok&&s[x+1][y-1]ok&&s[x+2][y-1]ok&&s[x+3][y-1]ok){
s[x+1][y]st,s[x+1][y-1]st,s[x+2][y-1]st,s[x+3][y-1]st,Dfs(nxt);
s[x+1][y]fr,s[x+1][y-1]fr,s[x+2][y-1]fr,s[x+3][y-1]fr;
}
if(s[x+1][y]ok&&s[x+2][y]ok&&s[x+2][y-1]ok&&s[x+3][y-1]ok){
s[x+1][y]st,s[x+2][y]st,s[x+2][y-1]st,s[x+3][y-1]st,Dfs(nxt);
s[x+1][y]fr,s[x+2][y]fr,s[x+2][y-1]fr,s[x+3][y-1]fr;
}
if(s[x+1][y]ok&&s[x+1][y+1]ok&&s[x+2][y+1]ok&&s[x+3][y+1]ok){
s[x+1][y]st,s[x+1][y+1]st,s[x+2][y+1]st,s[x+3][y+1]st,Dfs(nxt);
s[x+1][y]fr,s[x+1][y+1]fr,s[x+2][y+1]fr,s[x+3][y+1]fr;
}
if(s[x+1][y]ok&&s[x+2][y]ok&&s[x+2][y+1]ok&&s[x+3][y+1]ok){
s[x+1][y]st,s[x+2][y]st,s[x+2][y+1]st,s[x+3][y+1]st,Dfs(nxt);
s[x+1][y]fr,s[x+2][y]fr,s[x+2][y+1]fr,s[x+3][y+1]fr;
}
if(y>1&&s[x][y+1]ok&&s[x+1][y]ok&&s[x+1][y-1]ok&&s[x+1][y-2]ok){
s[x][y+1]st,s[x+1][y]st,s[x+1][y-1]st,s[x+1][y-2]st,Dfs(nxt);
s[x][y+1]fr,s[x+1][y]fr,s[x+1][y-1]fr,s[x+1][y-2]fr;
}
if(y>1&&s[x][y+1]ok&&s[x][y+2]ok&&s[x+1][y]ok&&s[x+1][y-1]ok){
s[x][y+1]st,s[x][y+2]st,s[x+1][y]st,s[x+1][y-1]st,Dfs(nxt);
s[x][y+1]fr,s[x][y+2]fr,s[x+1][y]fr,s[x+1][y-1]fr;
}
s[x][y]fr;able(ch);
}
ch='J';
if(can(ch)){
disable(ch);s[x][y]st;
if(s[x+1][y]ok&&s[x+1][y+1]ok&&s[x+2][y]ok&&s[x+1][y-1]ok){
s[x+1][y]st,s[x+1][y+1]st,s[x+2][y]st,s[x+1][y-1]st,Dfs(nxt);
s[x+1][y]fr,s[x+1][y+1]fr,s[x+2][y]fr,s[x+1][y-1]fr;
}
s[x][y]fr;able(ch);
}
ch='F';
if(can(ch)){
disable(ch);s[x][y]st;
if(s[x+1][y]ok&&s[x+1][y-1]ok&&s[x+1][y+1]ok&&s[x+1][y+2]ok){
s[x+1][y]st,s[x+1][y-1]st,s[x+1][y+1]st,s[x+1][y+2]st,Dfs(nxt);
s[x+1][y]fr,s[x+1][y-1]fr,s[x+1][y+1]fr,s[x+1][y+2]fr;
}
if(y>1&&s[x+1][y]ok&&s[x+1][y-1]ok&&s[x+1][y+1]ok&&s[x+1][y-2]ok){
s[x+1][y]st,s[x+1][y-1]st,s[x+1][y+1]st,s[x+1][y-2]st,Dfs(nxt);
s[x+1][y]fr,s[x+1][y-1]fr,s[x+1][y+1]fr,s[x+1][y-2]fr;
}
if(s[x+1][y]ok&&s[x+1][y+1]ok&&s[x+2][y]ok&&s[x+3][y]ok){
s[x+1][y]st,s[x+1][y+1]st,s[x+2][y]st,s[x+3][y]st,Dfs(nxt);
s[x+1][y]fr,s[x+1][y+1]fr,s[x+2][y]fr,s[x+3][y]fr;
}
if(s[x+1][y]ok&&s[x+1][y-1]ok&&s[x+2][y]ok&&s[x+3][y]ok){
s[x+1][y]st,s[x+1][y-1]st,s[x+2][y]st,s[x+3][y]st,Dfs(nxt);
s[x+1][y]fr,s[x+1][y-1]fr,s[x+2][y]fr,s[x+3][y]fr;
}
if(s[x][y+1]ok&&s[x+1][y+1]ok&&s[x][y+2]ok&&s[x][y+3]ok){
s[x][y+1]st,s[x+1][y+1]st,s[x][y+2]st,s[x][y+3]st,Dfs(nxt);
s[x][y+1]fr,s[x+1][y+1]fr,s[x][y+2]fr,s[x][y+3]fr;
}
if(s[x][y+1]ok&&s[x+1][y+2]ok&&s[x][y+2]ok&&s[x][y+3]ok){
s[x][y+1]st,s[x+1][y+2]st,s[x][y+2]st,s[x][y+3]st,Dfs(nxt);
s[x][y+1]fr,s[x+1][y+2]fr,s[x][y+2]fr,s[x][y+3]fr;
}
if(s[x+1][y]ok&&s[x+2][y+1]ok&&s[x+2][y]ok&&s[x+3][y]ok){
s[x+1][y]st,s[x+2][y+1]st,s[x+2][y]st,s[x+3][y]st,Dfs(nxt);
s[x+1][y]fr,s[x+2][y+1]fr,s[x+2][y]fr,s[x+3][y]fr;
}
if(s[x+1][y]ok&&s[x+2][y-1]ok&&s[x+2][y]ok&&s[x+3][y]ok){
s[x+1][y]st,s[x+2][y-1]st,s[x+2][y]st,s[x+3][y]st,Dfs(nxt);
s[x+1][y]fr,s[x+2][y-1]fr,s[x+2][y]fr,s[x+3][y]fr;
}
s[x][y]fr;able(ch);
}
ch='K';
if(can(ch)){
disable(ch);s[x][y]st;
if(s[x+1][y]ok&&s[x+1][y+1]ok&&s[x+2][y+1]ok&&s[x+2][y+2]ok){
s[x+1][y]st,s[x+1][y+1]st,s[x+2][y+1]st,s[x+2][y+2]st,Dfs(nxt);
s[x+1][y]fr,s[x+1][y+1]fr,s[x+2][y+1]fr,s[x+2][y+2]fr;
}
if(s[x][y+1]ok&&s[x+1][y+1]ok&&s[x+1][y+2]ok&&s[x+2][y+2]ok){
s[x][y+1]st,s[x+1][y+1]st,s[x+1][y+2]st,s[x+2][y+2]st,Dfs(nxt);
s[x][y+1]fr,s[x+1][y+1]fr,s[x+1][y+2]fr,s[x+2][y+2]fr;
}
if(y>1&&s[x+1][y]ok&&s[x+1][y-1]ok&&s[x+2][y-1]ok&&s[x+2][y-2]ok){
s[x+1][y]st,s[x+1][y-1]st,s[x+2][y-1]st,s[x+2][y-2]st,Dfs(nxt);
s[x+1][y]fr,s[x+1][y-1]fr,s[x+2][y-1]fr,s[x+2][y-2]fr;
}
if(s[x][y+1]ok&&s[x+1][y]ok&&s[x+1][y-1]ok&&s[x+2][y-1]ok){
s[x][y+1]st,s[x+1][y]st,s[x+1][y-1]st,s[x+2][y-1]st,Dfs(nxt);
s[x][y+1]fr,s[x+1][y]fr,s[x+1][y-1]fr,s[x+2][y-1]fr;
}
s[x][y]fr;able(ch);
}
}
int main(){
Init();
Dfs(1,1);
puts("No solution");
return 0;
}

【搜索好题】bzoj1501 [NOI2005]智慧珠游戏的更多相关文章

  1. [BZOJ1501][NOI2005] 智慧珠游戏

    Input 文件中包含初始的盘件描述,一共有10行,第i行有i个字符.如果第i行的第j个字符是字母”A”至”L”中的一个,则表示第i行第j列的格子上已经放了零件,零件的编号为对应的字母.如果第i行的第 ...

  2. 洛谷 P4205 [NOI2005]智慧珠游戏 DFS

    目录 题面 题目链接 题目描述 输入输出格式 输入格式 输出格式 输入输出样例 输入样例 输出样例 说明 思路 AC代码 总结 题面 题目链接 P4205 [NOI2005]智慧珠游戏 题目描述 智慧 ...

  3. bzoj 1501: [NOI2005]智慧珠游戏 Dancing Link

    1501: [NOI2005]智慧珠游戏 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 190  Solved: 122[Submit][Status] ...

  4. Luogu P4205 [NOI2005]智慧珠游戏

    国内少有的可以练习神仙算法--DLX的好题怎么可以被爆搜埋没呢? 看到这题没有DLX的题解所以写一篇,不过貌似我实现的太弱(构图太慢)所以速度上不是很快. 下面开始讲题,但请保证你要先学会DLX.(d ...

  5. 【BZOJ1501】【NOI2005】智慧珠游戏(搜索)

    [BZOJ1501][NOI2005]智慧珠游戏(搜索) 题面 我要一改我懒惰的作风 这道题目必须放题面 Description Input 文件中包含初始的盘件描述,一共有10行,第i行有i个字符. ...

  6. BZOJ 1501 智慧珠游戏

    Description Input 文件中包含初始的盘件描述,一共有10行,第i行有i个字符.如果第i行的第j个字符是字母”A”至”L”中的一个,则表示第i行第j列的格子上已经放了零件,零件的编号为对 ...

  7. zzulioj--1790-- 弹珠游戏(数学水题!)

    弹珠游戏 Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 14  Solved: 10 SubmitStatusWeb Board Descriptio ...

  8. 搜索 水题&&错误集锦

    引子: 本以为搜索的题目老师也不会检查,结果今天早上loli慢悠悠的说:“请同学们提交一下搜索的题目~”,顿时心旌摇曳,却也只能装作镇定自若的样子,点了点头.. 然后就开始了今天的疯狂做题,虽说题目都 ...

  9. Leetcode之广度优先搜索(BFS)专题-529. 扫雷游戏(Minesweeper)

    Leetcode之广度优先搜索(BFS)专题-529. 扫雷游戏(Minesweeper) BFS入门详解:Leetcode之广度优先搜索(BFS)专题-429. N叉树的层序遍历(N-ary Tre ...

随机推荐

  1. Yii2.0 发送邮件时中文附件乱码的问题

    yii自带的邮件类使用的是MIME 协议,发送附件时用的是MIME 协议的 Content-disposition扩展,用扩展下载中文名称的附件时有时会正常,有时会乱码. 只需找到如下文件 的如下方法 ...

  2. ValueError: Invalid leaf XXX

    Bug:ValueError: Invalid leaf XXX 无效的搜索条件——检查search函数中的domain表达式格式!是否少了括号! search(['user_id', '=', us ...

  3. DOM操作怎样添加、移除、移动、复制。创建和查找节点?

    (1)创建新节点 createDocumentFragment() //创建一个DOM片段 createElement() //创建一个具体的元素 createTextNode() //创建一个文本节 ...

  4. linq中当生成asp.net实体模式时

    linq中当生成asp.net实体模式时 注意: 选中 工具->库程序包管理器->管理解决方案的nuget程序包  选中下面的进行下载.

  5. 搭建elk的坑

    npm install  时总是报phantomjs-prebuilt@2.1.16安装失败: npm cache clean --force npm -g install phantomjs-pre ...

  6. arcgis js api proxy java 版本配置

    <?xml version="1.0" encoding="utf-8" ?> <ProxyConfig allowedReferers=&q ...

  7. Spring+Hibernate+struts2+JPA 注解+跨域//完成手机端点击加载更多 下拉加载更多

    一.使用IDEA新建一个maven项目(student) 1.1.0编写pom文件,添加项目所需要的包 <?xml version="1.0" encoding=" ...

  8. #leetcode刷题之路22-括号生成

    给出 n 代表生成括号的对数,请你写出一个函数,使其能够生成所有可能的并且有效的括号组合. 例如,给出 n = 3,生成结果为:[ "((()))", "(()())&q ...

  9. 【PTA 天梯赛】L3-003 社交集群(并查集)

    当你在社交网络平台注册时,一般总是被要求填写你的个人兴趣爱好,以便找到具有相同兴趣爱好的潜在的朋友.一个“社交集群”是指部分兴趣爱好相同的人的集合.你需要找出所有的社交集群. 输入格式: 输入在第一行 ...

  10. Mysql-多表连接的操作和用法

    一 .介绍 二 .多表连接查询 三 .符合条件连接查询 四 .子查询 一.介绍 本节主题 多表连接查询 复合条件连接查询 子查询 准备表 #建表 create table dep( id int, n ...