| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 180699 | C班詹皓杰 | 人际关系 | C++ | Accepted | 100 | 3 MS | 284 KB | 482 | 2024-08-21 17:23:54 |
#include<iostream> using namespace std; const int INF = 0x3f3f3f3f; int a[110][110]; int main(){ int n,A,B,t; cin>>n>>A>>B; for(int i = 1; i <= n; i++){ for(int j = 1; j <= n; j++){ cin>>t; if(t == 0){ a[i][j] = INF; }else{ a[i][j] = 1; } } } for(int k = 1; k <= n; k++){ for(int i = 1; i <= n; i++){ for(int j = 1; j <= n; j++){ a[i][j] = min(a[i][j],a[i][k]+a[k][j]); } } } cout<<a[A][B]-1; return 0; }