#CCBOTPBA0000014. Số ngày đủ nhiệt độ (Days in Temperature Range)
Số ngày đủ nhiệt độ (Days in Temperature Range)
Days in Temperature Range
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given temperatures over consecutive days, a day qualifies when 20 ≤ t ≤ 30. Output the total qualifying days and the longest consecutive qualifying run, or zero if none.
Input
Integer n followed by n temperatures.
Output
Print count maximum_run separated by a space.
Subtasks
-
Subtask 1 (20%):
1 ≤ n ≤ 10;-50 ≤ t ≤ 60. -
Subtask 2 (30%):
1 ≤ n ≤ 100;-50 ≤ t ≤ 60. -
Subtask 3 (50%):
1 ≤ n ≤ 365;-50 ≤ t ≤ 60.
Examples
Example 1
Input:
7
19 20 21 31 29 30 20
Output:
5 3
Explanation: Days 2, 3, 5, 6, and 7 qualify; the final run has length three.
Example 2
Input:
3
-1 19 31
Output:
0 0
Explanation: No temperature lies in the inclusive interval.