Editorial for QCC P2 - Online School
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
Subtask 1
Brute force suffices.
Time Complexity:
Subtask 2
Notice for each type of query:
1 w
: denotes .
- If the array is sorted, the values in the column are ordered as: . The maximal value is: .
2 w
: denotes .
- If the array is sorted, the values in the column are ordered as: . The minimal value is: .
3 w
: denotes .
- If the array is sorted, the values in the row are ordered as: . The maximal value is: .
4 w
: denotes .
- If the array is sorted, the values in the row are ordered as: . The minimal value is: .
The and of arrays and can be found in time and stored before answering any queries.
Time Complexity:
Comments