PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#PS0000130. So sánh trung bình bằng số nguyên (Compare Range Average)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
So sánh trung bình bằng số nguyên (Compare Range Average)
Compare Range Average
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given integers , each query specifies an inclusive interval and integers with representing . Determine whether the arithmetic mean of the entries in the interval is at least . Equality is accepted. The array never changes.
Input
The first line contains , array length and query count.
The second line contains integers .
Each of the next lines contains integers .
Output
Print lines; print YES if the mean is at least , otherwise NO.
Subtasks
- Subtask 1 (25 points): ; ; for each query; for every ; ; .
- Subtask 2 (25 points): ; ; for each query; for every ; ; .
- Subtask 3 (50 points): ; ; for each query; for every ; ; .
Example 1
Input
3 2
1 3 5
1 3 3 1
1 2 3 1
Output
YES
NO
Explanation
The mean of 1–3 is , equal to . The mean of 1–2 is , below 3.
Example 2
Input
3 3
-5 -2 4
1 2 -7 2
1 2 -3 1
3 3 3999999999 1000000000
Output
YES
NO
YES
Explanation
The first two entries average , equal to the first threshold but smaller than . The final entry is 4, above .