Solved RoyFloyd Algorithm