79222024-01-12 07:14:25rancealexkriszFasor (40)cpp17Runtime error 0/4076ms15560 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<=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;
      }
    }
   /* 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
1Runtime error0/03ms1972 KiB
2Runtime error0/06ms2200 KiB
3Runtime error0/23ms2412 KiB
4Runtime error0/23ms2560 KiB
5Runtime error0/23ms2960 KiB
6Runtime error0/23ms3232 KiB
7Runtime error0/23ms3304 KiB
8Runtime error0/24ms3496 KiB
9Runtime error0/26ms3320 KiB
10Runtime error0/26ms3412 KiB
11Runtime error0/26ms3532 KiB
12Runtime error0/24ms3520 KiB
13Runtime error0/239ms5084 KiB
14Runtime error0/235ms5876 KiB
15Runtime error0/261ms7852 KiB
16Runtime error0/271ms8888 KiB
17Runtime error0/276ms10312 KiB
18Runtime error0/276ms11604 KiB
19Runtime error0/276ms13012 KiB
20Runtime error0/224ms12572 KiB
21Runtime error0/261ms14208 KiB
22Runtime error0/276ms15560 KiB