124122024-12-17 11:46:42ffteklaFasor (40)cpp17Time limit exceeded 22/40300ms1172 KiB
#include <iostream>

using namespace std;

int N,K,v[200001],i,y,x,a,b;

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;
         if(i!=1)
         {
           for(x=a;x<i;++x)
           {
               if(v[x]>v[i])
               {
                   y=1;
                   break;
               }
           }
         }
         if(i+K>N) b=N;
         else b=i+K;
         if(i!=N)
         {
           for(x=i+1;x<=b;++x)
           {
               if(v[x]>v[i])
               {
                   y=1;
                   break;
               }
           }
         }
         if(y==-1)
         {
             cout<<i;
             break;
         }
     }
}
SubtaskSumTestVerdictTimeMemory
base22/40
1Accepted0/01ms320 KiB
2Accepted0/04ms508 KiB
3Accepted2/21ms320 KiB
4Accepted2/21ms320 KiB
5Accepted2/21ms320 KiB
6Accepted2/21ms320 KiB
7Accepted2/21ms320 KiB
8Accepted2/22ms648 KiB
9Accepted2/24ms424 KiB
10Accepted2/24ms320 KiB
11Accepted2/24ms320 KiB
12Accepted2/23ms372 KiB
13Time limit exceeded0/2300ms628 KiB
14Time limit exceeded0/2300ms636 KiB
15Time limit exceeded0/2298ms1152 KiB
16Time limit exceeded0/2300ms1172 KiB
17Time limit exceeded0/2284ms1080 KiB
18Time limit exceeded0/2287ms1080 KiB
19Time limit exceeded0/2287ms1048 KiB
20Time limit exceeded0/2287ms692 KiB
21Time limit exceeded0/2284ms1080 KiB
22Accepted2/272ms976 KiB