Solving P7077: Function Calls with Topological Sorting

Problem Statement We are given an array a of length n and m operations. There are three types of operations: Addition: Given x and y, increase a[x] by y. Multiplication: Given x, multip all elements in a by x. Function Call: Given k operation indices c_1, c_2, ..., c_k, execute the operations c_1, c_2, ..., c_k in sequence. The problem guaran ...

Posted on Sun, 17 May 2026 15:38:22 +0000 by Tekron-X

All-Pairs Shortest Path Computation Using the Floyd-Warshall Method

The Floyd-Warshall algorithm solves the all-pairs shortest path problem in a weighted graph, handling both positive and negative edge weights (with no negative cycles). It uses dynamic programming to iteratively improve shortest path estimates between every pair of vertices. Core Principal Define dist[i][j][k] as the shortest distance from node ...

Posted on Fri, 15 May 2026 09:39:48 +0000 by Rovas