A. City Day

滴答滴答---题目链接

time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

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-rainyday for the celebration. The mayor knows the weather forecast for the nn days of summer. On the ii-th day, aiai millimeters of rain will fall. All values aiai 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 ddis not-so-rainy if adad 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<ajad<aj should hold for all d−x≤j<dd−x≤j<d and d<j≤d+yd<j≤d+y. Citizens only watch the weather during summer, so we only consider such jj that 1≤j≤n1≤j≤n.

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

Input

The first line contains three integers nn, xx and yy (1≤n≤1000001≤n≤100000, 0≤x,y≤70≤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 nn distinct integers a1a1, a2a2, ..., anan (1≤ai≤1091≤ai≤109), where aiai denotes the rain amount on the ii-th day.

Output

Print a single integer — the index of the earliest not-so-rainy day of summer. We can show that the answer always exists.

Examples

input

Copy

10 2 2
10 9 6 7 8 3 2 1 4 5

output

Copy

3

input

Copy

10 2 3
10 9 6 7 8 3 2 1 4 5

output

Copy

8

input

Copy

5 5 5
100000 10000 1000 100 10

output

Copy

5

Note

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>a6a3>a6. 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.

#include <iostream>
#include<stdio.h>
#include<string.h>
#include<map>
using namespace std;
const int maxn=1e5+10;
int a[maxn];
//int b[maxn];
int main()
{
    int n,x,y;
    int p=0;
    memset(a,0,sizeof(a));
    scanf("%d%d%d",&n,&x,&y);
    for(int i=1; i<=n; i++)
        scanf("%d",&a[i]);
    for(int i=1; i<=n; i++)
    {
        int x1,y1;
        x1=x;
        y1=y;
        int flas=1;
        int l,r;
        l=r=i;
        int ans=a[i];
        while(l>1&&x1>1)
        {
           // printf("i = %d a[l] = %d l = %d ans = %d\n",i,a[l],l,ans);
            x1--;
            l--;
            if(a[l]<ans)
            {
               // printf("i = %d a[l] = %d l = %d ans = %d\n",i,a[l],l,ans);
                flas=0;
                //printf("l====%d\n",l);
                break;
            }

        }
        while(y1>0&&r<n)
        {
            //printf("i = %d a[r] = %d r = %d ans = %d\n",i,a[r],r,ans);

            y1--;
            r++;
            if(a[r]<ans)
            {
                //printf("r=== %d\n",r);
                flas=0;
                break;
            }

        }
        //printf("i = %d  %d",i,flas);
        if(flas)
        {
           // printf("i = %d\n",i);
            p=i;
            break;
        }
       // cout<<endl;
    }
    printf("%d\n",p);
    return 0;
}

我天,熬夜啦,睡觉觉~~~

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值