最短路径
#include<iostream>
#include<cstring>
#include<cmath>
#define inf 0x3f3f3f3f
using namespace std;
const int N=105;
int mapp[N][N];
int main(){
int n,s;
cin>>n>>s;
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
string s;
cin>>s;
if(s=="-")mapp[i][j]=inf;
else mapp[i][j]=stoi(s);
}
}
for(int k=1;k<=n;k++)
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
mapp[i][j]=min(mapp[i][j],mapp[i][k]+mapp[k][j]);
for(int i=1;i<=n;i++)
if(i==s)continue;
else printf("(%d -> %d) = %d\n",s,i,mapp[s][i]);
return 0;
}