#include #include using namespace std; struct node { int pos,st,step,pre; node(){} node(int _p,int _st,int _step) { pos=_p; st=_st; step=_step; } }; bool had_answer,G[20][20],vis[20][1<<17]; int n,m,s,t,res,head,tail,kase; node st; node que[20<<17]; void init() { memset(&st,0,sizeof(st)); memset(G,0,sizeof(G)); memset(vis,0,sizeof(vis)); head=tail=1; scanf("%d%d%d%d",&n,&m,&s,&t); int x,y; for(int i=0;i>=1; } return res; } void print(int n) { top=0; while(n!=0) { stk[top++]=que[n].st; n=que[n].pre; } while(top>1) { int x=stk[top-1]^stk[top-2],a=count(lowbit(x))-1,b=count(lowbit(x&~lowbit(x)))-1; if(stk[top-1]&1<0) { int st=que[head].st; for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) if(i!=j&&G[i][j]&&((st&1<>i)&&!((st&1<>j)) { que[tail].pos=(i==que[head].pos?j:que[head].pos); que[tail].pre=head; que[tail].step=que[head].step+1; que[tail].st=(st&(~(1<0) { init(); solve(); } return 0; }