#P9286. [ROI 2018] Extraction of radium
[ROI 2018] Extraction of radium
Background
Translated from ROI 2018 Day1 T1. Добыча радия (Extraction of radium).
Problem Description
You are given an matrix , and all numbers in the matrix are pairwise distinct.
Then there are updates. Each update changes one value to a larger value. It is guaranteed that after each update, all numbers in the matrix are still pairwise distinct.
After each update, compute how many numbers in the matrix are both the maximum in their row and the maximum in their column.
Input Format
The first line contains three integers , , , representing the size of the matrix and the number of updates.
The next lines each contain integers, describing the matrix.
The next lines each contain three integers , , , meaning to change the element in row and column to .
Output Format
Output lines, each containing one integer, representing after each update how many numbers in the matrix satisfy the condition.
2 3 3
1 4 3
6 5 2
2 2 9
1 3 5
2 2 10
1
2
2
Hint
Constraints: For all testdata, , , .
| Subtask ID | ||
|---|---|---|
Translated by ChatGPT 5