At the Nova Theatre, the balcony seats can be seen as a grid with
Constraints
Subtask 1 [10%]
Subtask 2 [30%]
Subtask 3 [10%]
Subtask 4 [50%]
Input Specification
The first line will contain three space-separated integers,
The next
Sample Input 1
3 4 5
1 1
1 2
1 3
2 1
3 1
Sample Output 1
9
Explanation for Sample 1
Initially, the grid appears as:
S S S O
S O O O
S O O O
where S
denotes someone standing and O
denotes someone sitting.
Then it becomes:
S S S O
S S O O
S O O O
Then:
S S S O
S S S O
S S O O
Finally:
S S S O
S S S O
S S S O
No more people stand, so the
Sample Input 2
3 5 4
1 1
3 1
1 4
2 5
Sample Output 2
7
Sample Input 3
3 5 4
1 1
3 1
1 3
2 4
Sample Output 3
12
Comments