124102024-12-17 11:43:25ffteklaFasor (40)cpp17Time limit exceeded 22/40300ms1320 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;
         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)
         {
             cout<<i;
             break;
         }
     }
}
SubtaskSumTestVerdictTimeMemory
base22/40
1Accepted0/01ms320 KiB
2Accepted0/04ms320 KiB
3Accepted2/21ms320 KiB
4Accepted2/21ms320 KiB
5Accepted2/21ms320 KiB
6Accepted2/21ms320 KiB
7Accepted2/21ms320 KiB
8Accepted2/22ms428 KiB
9Accepted2/24ms500 KiB
10Accepted2/24ms512 KiB
11Accepted2/24ms500 KiB
12Accepted2/23ms320 KiB
13Time limit exceeded0/2300ms800 KiB
14Time limit exceeded0/2300ms624 KiB
15Time limit exceeded0/2300ms1120 KiB
16Time limit exceeded0/2298ms1076 KiB
17Time limit exceeded0/2287ms1080 KiB
18Time limit exceeded0/2287ms972 KiB
19Time limit exceeded0/2287ms1080 KiB
20Time limit exceeded0/2287ms744 KiB
21Time limit exceeded0/2282ms1080 KiB
22Accepted2/271ms1320 KiB