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. 【[USACO08JAN]haybale猜测Haybale Guessing】

    抄题解.jpg 完全完全不会啊,这道题简直太神了 不过抄题解可真开心 首先这道题目保证了每一个位置上的数都是不同的,那么就能得到第一种判断不合法的方式 如果两个区间的最小值一样,但是两个区间的交集为空 ...

  2. docker-8-本地镜像发布到阿里云

    镜像的生成方法 1.前面的DockerFile   2.从容器创建一个新的镜像 docker commit [OPTIONS] 容器ID [REPOSITORY[:TAG]] 将本地镜像推送到阿里云 ...

  3. Monkeyrunner测试小实践

    环境搭建完成后,我们通过命令打开模拟器,前提是在Eclipse中创建了一个模拟器 (1)cmd命令:emulator -avd 模拟器名称 启动了模拟器,此时你就会看到一个安卓模拟器的弹出 (2)cm ...

  4. stm32 晶振不起振

    1. STM32f103有内部晶振.刚刚上电时,所有Clock都是源于内部晶振,所以当片内没有程序或内部程序没有使能外部晶振时,外部晶振是不会起振的.2. STM32f103有内部复位电路,只有当检测 ...

  5. windows下nginx访问web目录提示403 Forbidden

    在windows下 http服务器nginx时,访问web目录提示403 Forbidden,首先需要了解nginx出现403错误是什么意思: 403 Forbidden表示你在请求一个资源文件但是n ...

  6. 精准测试白皮书v3.0-2019最新版

    现代社会是建立在各种以计算机为基石的软件技术基础之上的.随着日新月异的需求变化,软件系统越来越复杂.很多人觉得软件开发才是重要环节,但实际上,无法对大型软件进行有效的质量把控,就无法真正构建与维护大型 ...

  7. 【原创】如何使用Jmockit进行单元测试

    如何使用jmockit进行单元测试 1. Jmockit简介 JMockit 是用以帮助开发人员编写测试程序的一组工具和API,它完全基于 Java 5 SE 的 java.lang.instrume ...

  8. PLSQL数据库无选项问题解决

    添加如下ORACLE_HOME和OCI library 添加之后,关闭plsql再打开会出现如下界面: 其中database为空. 我当时也是在环境变量里面配置了TNS_ADMIN的环境变量为:如下 ...

  9. 【MySQL】基本语句

    ##mac启动mysql的命令语句## /usr/local/mysql/bin/mysql -u root -p ##然后输入密码 查看当前存在数据库 show databases; 创建数据库 c ...

  10. #leetcode刷题之路31-下一个排列

    实现获取下一个排列的函数,算法需要将给定数字序列重新排列成字典序中下一个更大的排列.如果不存在下一个更大的排列,则将数字重新排列成最小的排列(即升序排列).必须原地修改,只允许使用额外常数空间. 以下 ...