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 nn days of summer. On the ii-th day, aia_i millimeters of rain will fall. All values aia_i are distinct.

The mayor knows that citizens will watch the weather xx days before the celebration and yy days after. Because of that, he says that a day dd is not-so-rainy if ada_d is smaller than rain amounts at each of xx days before day dd and and each of yy days after day dd. In other words, ad<aja_d \lt a_j should hold for all d−x≤j<dd - x \le j \lt d and d<j≤d+yd \lt j \le d + y. Citizens only watch the weather during summer, so we only consider such jj that 1≤j≤n1 \le j \le n.

Help mayor find the earliest not-so-rainy day of summer.

多年来,城市 N 的市庆日一直定在夏季降雨量最多的一天。新任市长决定打破这一传统,为庆祝活动选择一个“不太 rainy”的日子。市长掌握了夏季 nn 天的天气预报:第 ii 天将降下 aia_i 毫米的雨水。所有 aia_i 值互不相同。

市长知道,市民会在庆祝日之前 xx 天及之后 yy 天关注天气情况。因此,他将某一天 dd 定义为“不太 rainy”的日子,当且仅当 ada_d 小于 dd 之前连续 xx 天以及 dd 之后连续 yy 天的所有降雨量。换言之,对所有满足 d−x≤j<dd - x \le j < d 和 d<j≤d+yd < j \le d + y 的 jj,均需满足 ad<aja_d < a_j。由于市民只在夏季关注天气,我们仅考虑满足 1≤j≤n1 \le j \le n 的那些 jj。

请帮助市长找出夏季最早的“不太 rainy”的日子。

输入格式

The first line contains three integers nn, xx and yy (1≤n≤100 0001 \le n \le 100\,000, 0≤x,y≤70 \le x, y \le 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 nn distinct integers a1a_1, a2a_2, ..., ana_n (1≤ai≤1091 \le a_i \le 10^9), where aia_i denotes the rain amount on the ii-th day.

第一行包含三个整数 nn、xx 和 yy(1≤n≤100 0001 \le n \le 100\,000,0≤x,y≤70 \le x, y \le 7)—— 分别表示夏季的天数、市民在庆祝活动前观察天气的天数,以及庆祝活动后观察天气的天数。

第二行包含 nn 个互不相同的整数 a1a_1、a2a_2、...、ana_n(1≤ai≤1091 \le a_i \le 10^9),其中 aia_i 表示第 ii 天的降雨量。

输出格式

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 33 and 88 are not-so-rainy. The 33-rd day is earlier.

In the second example day 33 is not not-so-rainy, because 3+y=63 + y = 6 and a3>a6a_3 \gt a_6. Thus, day 88 is the answer. Note that 8+y=118 + y = 11, but we don't consider day 1111, because it is not summer.

在第一个例子中,第 33 天和第 88 天是“不太下雨”的日子。其中第 33 天更早。

在第二个例子中,第 33 天不是“不太下雨”的日子,因为 3+y=63 + y = 6 且 a3>a6a_3 \gt a_6。因此,答案是第 88 天。注意 8+y=118 + y = 11,但我们不考虑第 1111 天,因为它不在夏季。

输入解题思路,AI测评打分。不知道怎么写?

首页