80pts 求助

P1613 跑路

@[12468C](/user/552088) 把maxn调大点,我改成100,过了
by Loser_Syx @ 2023-01-31 10:35:45


@[Saint_ying_xtf](/user/852144) [调大后...](https://www.luogu.com.cn/record/100924980)
by 12468C @ 2023-01-31 10:46:03


@[12468C](/user/552088) 自己看 ```cpp #include<bits/stdc++.h> using namespace std; const int maxn=100; int dis[maxn][maxn]; int s1[maxn][maxn][35]; int n,m; int main(){ memset(dis,0x3f,sizeof(dis)); memset(s1,0,sizeof(s1)); cin>>n>>m; for(int i=1;i<=m;i++){ int t1,t2; cin>>t1>>t2; if(t1==t2){ dis[t1][t2]=0; } else{ dis[t1][t2]=1; } s1[t1][t2][0]=1; } for(int k=0;k<32;k++){ for(int kk=1;kk<=n;kk++){ for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ if(s1[i][kk][k]==1&&s1[kk][j][k]==1){ s1[i][j][k+1]=1; if(i==j){ dis[i][j]=0; } else{ dis[i][j]=1; } } } } } } for(int k=1;k<=n;k++){ for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ dis[i][j]=min(dis[i][j],dis[i][k]+dis[k][j]); } } } cout<<dis[1][n]; return 0; } ```
by Loser_Syx @ 2023-01-31 10:47:24


@[Saint_ying_xtf](/user/852144) 谢谢dalao,[已A掉](https://www.luogu.com.cn/record/100925670)
by 12468C @ 2023-01-31 10:50:14


|