[Codeforces] April Fools Day Contest 2016 E. Out of Controls

April Fools Day Contest 2016 E. Out of Controls

  • Time :
  • Space :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include<bits/stdc++.h>
using namespace std;
int a[105][105],n,res;
int main()
{
cin>>n;
f\
o\
r(int i=1;i<=n;i++)
f\
o\
r(int j=1;j<=n;j++)cin>>a[i][j];
f\
o\
r(int k=1;k<=n;k++)
f\
o\
r(int i=1;i<=n;i++)
f\
o\
r(int j=1;j<=n;j++)a[i][j]=min(a[i][j],a[i][k]+a[k][j]);
f\
o\
r(int i=1;i<=n;i++)
f\
o\
r(int j=1;j<=n;j++)res=max(res, a[i][j]);
cout << res;
}

Author: Song Hayoung
Link: https://songhayoung.github.io/2023/11/19/PS/Codeforces/april-fools-contest-2016-e/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.