#P2442. 分数统计
分数统计
Description
Yellow_sword asks Da Ning to build a database to maintain the class exam averages. Each student’s scores for the midterm subjects have been unified into a single rating, an integer in . This rating evaluates a student’s overall level. Now Yellow_sword has given Da Ning the average rating of classes and the size of each class. Because both Yellow_sword and Da Ning are lazy, they will assume every student in a class has a rating equal to that class’s average rating. He wants to know:
- The average rating of all students over some consecutive classes.
- The mode of all students’ ratings over some consecutive classes (if there are multiple, output the smallest mode).
- The range of all students’ ratings over some consecutive classes (that is, the difference between the highest and lowest ratings).
Since everyone is lazy, the task is given to you.
Input Format
The first line contains two integers and , the number of classes and the number of queries.
The second line contains integers , the average rating of the -th class.
The third line contains integers , the size of the -th class.
The next lines each contain one query in the format: Opt u v.
This means to query the item corresponding to over classes from to , as described above.
Output Format
For each query, output the corresponding result on its own line. For the average, print exactly two decimal places, rounded down (floor).
5 3
90 100 90 90 80
2 1 2 1 8
1 1 3
2 3 5
3 1 2
92.00
80
10
Hint
For of the testdata, it is guaranteed that , .
| Test point | Scale | Time limit |
|---|---|---|
It is recommended to use fast I/O.
Translated by ChatGPT 5
京公网安备 11011102002149号