CF1199A.City Day
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
For years, the Day of city N was held in the most rainy day of summer. New mayor decided to break this tradition and select a not-so-rainy day for the celebration. The mayor knows the weather forecast for the n days of summer. On the i-th day, ai millimeters of rain will fall. All values ai are distinct.
The mayor knows that citizens will watch the weather x days before the celebration and y days after. Because of that, he says that a day d is not-so-rainy if ad is smaller than rain amounts at each of x days before day d and and each of y days after day d. In other words, ad<aj should hold for all d−x≤j<d and d<j≤d+y. Citizens only watch the weather during summer, so we only consider such j that 1≤j≤n.
Help mayor find the earliest not-so-rainy day of summer.
多年来,城市 N 的市庆日一直定在夏季降雨量最多的一天。新任市长决定打破这一传统,为庆祝活动选择一个“不太 rainy”的日子。市长掌握了夏季 n 天的天气预报:第 i 天将降下 ai 毫米的雨水。所有 ai 值互不相同。
市长知道,市民会在庆祝日之前 x 天及之后 y 天关注天气情况。因此,他将某一天 d 定义为“不太 rainy”的日子,当且仅当 ad 小于 d 之前连续 x 天以及 d 之后连续 y 天的所有降雨量。换言之,对所有满足 d−x≤j<d 和 d<j≤d+y 的 j,均需满足 ad<aj。由于市民只在夏季关注天气,我们仅考虑满足 1≤j≤n 的那些 j。
请帮助市长找出夏季最早的“不太 rainy”的日子。
输入格式
The first line contains three integers n, x and y (1≤n≤100000, 0≤x,y≤7) — the number of days in summer, the number of days citizens watch the weather before the celebration and the number of days they do that after.
The second line contains n distinct integers a1, a2, ..., an (1≤ai≤109), where ai denotes the rain amount on the i-th day.
第一行包含三个整数 n、x 和 y(1≤n≤100000,0≤x,y≤7)—— 分别表示夏季的天数、市民在庆祝活动前观察天气的天数,以及庆祝活动后观察天气的天数。
第二行包含 n 个互不相同的整数 a1、a2、...、an(1≤ai≤109),其中 ai 表示第 i 天的降雨量。
输出格式
Print a single integer — the index of the earliest not-so-rainy day of summer. We can show that the answer always exists.
输出一个整数——夏季最早的一个“不太下雨”的日期的索引。可以证明答案一定存在。
输入输出样例
输入#1
10 2 2 10 9 6 7 8 3 2 1 4 5
输出#1
3
输入#2
10 2 3 10 9 6 7 8 3 2 1 4 5
输出#2
8
输入#3
5 5 5 100000 10000 1000 100 10
输出#3
5
说明/提示
In the first example days 3 and 8 are not-so-rainy. The 3-rd day is earlier.
In the second example day 3 is not not-so-rainy, because 3+y=6 and a3>a6. Thus, day 8 is the answer. Note that 8+y=11, but we don't consider day 11, because it is not summer.
在第一个例子中,第 3 天和第 8 天是“不太下雨”的日子。其中第 3 天更早。
在第二个例子中,第 3 天不是“不太下雨”的日子,因为 3+y=6 且 a3>a6。因此,答案是第 8 天。注意 8+y=11,但我们不考虑第 11 天,因为它不在夏季。
输入解题思路,AI测评打分。不知道怎么写?