79302024-01-12 07:39:12rancealexkriszFasor (40)cpp17Wrong answer 4/40263ms5040 KiB
#include <iostream>

using namespace std;

int main()
{
    int n,k,db=0,hossz=0;
    cin>>n>>k;
    int tomb[n+1] = {0};
    for(int i=1;i<=n;i++)
    {
        cin>>tomb[i];
    }
    for(int i=k+1;i<=n and db==0;i++)
    {
      hossz=0;
      for(int y=i-1;y>=i-k;y--)
      {
          if(tomb[i]>tomb[y]) hossz++;
          else hossz=0;
          if(hossz==k) db=i;
      }
     // cout<<hossz<<endl;
    }
   /* 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
base4/40
1Accepted0/03ms1872 KiB
2Accepted0/04ms2112 KiB
3Wrong answer0/23ms2288 KiB
4Wrong answer0/23ms2376 KiB
5Wrong answer0/23ms2580 KiB
6Accepted2/23ms2792 KiB
7Wrong answer0/23ms3016 KiB
8Wrong answer0/23ms3072 KiB
9Wrong answer0/26ms3240 KiB
10Accepted2/26ms3320 KiB
11Wrong answer0/26ms3444 KiB
12Wrong answer0/24ms3676 KiB
13Time limit exceeded0/2204ms4284 KiB
14Wrong answer0/234ms4268 KiB
15Time limit exceeded0/2238ms3464 KiB
16Time limit exceeded0/2250ms3508 KiB
17Time limit exceeded0/2246ms3496 KiB
18Time limit exceeded0/2254ms3508 KiB
19Wrong answer0/274ms5040 KiB
20Time limit exceeded0/2263ms3028 KiB
21Time limit exceeded0/2254ms3488 KiB
22Time limit exceeded0/2250ms3484 KiB