124132024-12-17 11:50:43ffteklaFasor (40)cpp17Time limit exceeded 22/40300ms1132 KiB
#include <iostream>

using namespace std;

int N,K,v[200001],i,y,x,a,b,c=-1;

int main()
{
     cin>>N>>K;
     for(i=1;i<=N;++i)
     {
         cin>>v[i];
     }
     for(i=1;i<=N;++i)
     {
         y=-1;
         if(i-K<1) a=1;
         else a=i-K;
           for(x=a;x<i;++x)
           {
               if(v[x]>v[i])
               {
                   y=1;
                   break;
               }
           }
         if(i+K>N) b=N;
         else b=i+K;
           for(x=i+1;x<=b;++x)
           {
               if(v[x]>v[i])
               {
                   y=1;
                   break;
               }
           }
         if(y==-1)
         {
             c=i;
             break;
         }
     }
     cout<<c;
}
SubtaskSumTestVerdictTimeMemory
base22/40
1Accepted0/01ms320 KiB
2Accepted0/04ms500 KiB
3Accepted2/21ms320 KiB
4Accepted2/21ms320 KiB
5Accepted2/21ms320 KiB
6Accepted2/21ms320 KiB
7Accepted2/21ms320 KiB
8Accepted2/21ms320 KiB
9Accepted2/23ms424 KiB
10Accepted2/24ms416 KiB
11Accepted2/24ms448 KiB
12Accepted2/23ms320 KiB
13Time limit exceeded0/2298ms628 KiB
14Time limit exceeded0/2300ms620 KiB
15Time limit exceeded0/2300ms940 KiB
16Time limit exceeded0/2300ms1132 KiB
17Time limit exceeded0/2289ms1128 KiB
18Time limit exceeded0/2289ms1080 KiB
19Time limit exceeded0/2291ms992 KiB
20Time limit exceeded0/2291ms568 KiB
21Time limit exceeded0/2282ms1080 KiB
22Accepted2/275ms1088 KiB