Looking for Order题解

Looking for Order题解

倒是一道简单题,
状压dp,
没什么说的,

#include
using namespace std;
const int N=17e6+7,M=26;
int n,p,f[N],dis[M][M],x[M],y[M],inf,w,t,pre[N],q;
inline int read(){
   int T=0,F=1; char ch=getchar();
   while(ch<'0'||ch>'9'){if(ch=='-') F=-1; ch=getchar();}
   while(ch>='0'&&ch<='9') T=(T<<3)+(T<<1)+(ch-48),ch=getchar();
   return F*T;
}
int main(){
    memset(f,0x3f,sizeof(f)),inf=f[0],f[0]=0,x[0]=read(),y[0]=read(),n=read(),p=(1<f[i]+w) f[t]=f[i]+w,pre[t]=i;
            }
            break;
        }
    }
    printf("%d\n",f[p-1]),--p;
    while(p){
      printf("0 "),w=(p^pre[p]),t=(int)log2(w),p=pre[p];
      if(w!=(1<

你可能感兴趣的:(Looking for Order题解)