78622024-01-11 14:02:43rancealexkriszFasor (40)cpp17Time limit exceeded 0/40277ms3680 KiB
#include <iostream>

using namespace std;

int main()
{
    int n,k,db=0,hossz;
    cin>>n>>k;
    int tomb[n+1] = {0};
    for(int i=1;i<=n;i++)
    {
        cin>>tomb[i];
    }
    for(int i=1;i<=k and db==0;i++)
    {
      for(int y=i+1;y<=i+k;i++)
      {
          if(tomb[i]>tomb[y]) hossz++;
          else hossz=0;
          if(hossz==k) db=i;
      }
    }
    for(int i=k+1;i<=n-k and db==0;i++)
    {
      for(int y=i-1;y>=i-k;i--)
      {
          if(tomb[i]>tomb[y]) hossz++;
          else hossz=0;
          if(hossz==k) db=i;
      }
      for(int y=i+1;y<=i+k;i++)
      {
          if(tomb[i]>tomb[y]) hossz++;
          else hossz=0;
          if(hossz==k) db=i;
      }
    }
    for(int i=n-k+1;i<=n and db==0;i++)
    {
      for(int y=i-1;y>=i-k;i--)
      {
          if(tomb[i]>tomb[y]) hossz++;
          else hossz=0;
          if(hossz==k) db=i;
      }
    }
    cout<<db;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/40
1Time limit exceeded0/0272ms1856 KiB
2Time limit exceeded0/0268ms1288 KiB
3Time limit exceeded0/2273ms1588 KiB
4Time limit exceeded0/2250ms2520 KiB
5Time limit exceeded0/2277ms2596 KiB
6Time limit exceeded0/2240ms2236 KiB
7Time limit exceeded0/2257ms2024 KiB
8Time limit exceeded0/2268ms2020 KiB
9Time limit exceeded0/2270ms2156 KiB
10Time limit exceeded0/2270ms2416 KiB
11Time limit exceeded0/2273ms2572 KiB
12Time limit exceeded0/2248ms3332 KiB
13Time limit exceeded0/2245ms3056 KiB
14Time limit exceeded0/2248ms3108 KiB
15Time limit exceeded0/2261ms3448 KiB
16Time limit exceeded0/2252ms3444 KiB
17Time limit exceeded0/2273ms3444 KiB
18Time limit exceeded0/2237ms3520 KiB
19Time limit exceeded0/2237ms3632 KiB
20Time limit exceeded0/2261ms3324 KiB
21Time limit exceeded0/2264ms3680 KiB
22Time limit exceeded0/2273ms3576 KiB