Problem 2718 · Medium

Sum of Matrix After Queries

Process queries from last to first so that only the newest write to each row or column is counted.

Open the interactive visualisation