PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#PS0000227. Đếm ô đạt ngưỡng trong hình chữ nhật (Threshold Rectangle Count)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Đếm ô đạt ngưỡng trong hình chữ nhật (Threshold Rectangle Count)
Threshold Rectangle Count
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given a static matrix indexed from 1 with entries from 1 to 10, each query asks for the number of cells satisfying , and . Boundaries and equality are included; the matrix never changes.
Input
The first line contains , followed by rows of exactly integers. Each of the next lines contains .
Output
Print lines, one count per query.
Subtasks
- Subtask 1 (20 points): ; ; ; ; ; .
- Subtask 2 (30 points): ; ; ; ; ; ; .
- Subtask 3 (50 points): ; ; ; ; ; .
Example 1
Input
2 3 4
1 5 10
7 5 2
1 1 2 3 5
1 2 2 2 5
1 1 1 3 10
2 1 2 3 1
Output
4
2
1
3
Explanation
The first query counts 5,10,7,5; the second counts two fives; the third counts 10; the last counts the entire second row.
Example 2
Input
1 2 2
1 1
1 1 1 2 2
1 1 1 2 1
Output
0
2
Explanation
Neither cell reaches 2; both reach 1.