G2A Many GEOs
SHARE
TWEET

acmp 126

TheQwaad Apr 8th, 2020 173 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. N = int(input())
  2. shortest = 5000
  3. A = [list(map(int,input().split())) for i in range(N)]
  4.  
  5.  
  6. for i in range(0,N):
  7.     for j in range(1,N):
  8.         if i == j:
  9.             continue
  10.         for k in range(2,N):
  11.             if j == k or i == k:
  12.                 continue
  13.             marsh = A[i][j] + A[j][k] + A [k][i]
  14.             if marsh < shortest:
  15.                 shortest = marsh
  16.  
  17. print(shortest)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top