25792023-01-17 15:27:24pyramisFasor (40)cpp11Accepted 40/4074ms5808 KiB
#include <iostream>

using namespace std;

int main()
{
    int n;
    int d;

    cin>>n;
    cin>>d;

    int fasor[n];

    for(int i=0; i<n; i++){
        cin>>fasor[i];
    }

    bool rossz_hely;
    for(int i=0; i<n; i++){
        rossz_hely=false;
        for(int j=i-d; j<=i+d; j++){
            if(j>=0 && j<n){
            if(fasor[j]> fasor[i]){
                i=j-1; //tovabblepek a maxra
                rossz_hely=true;
                break;
            }
        }
    }
        if(rossz_hely==false){
            cout<<i+1;
            return 0;

        }
    }






    return 0;
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/03ms1872 KiB
2Accepted0/04ms2164 KiB
3Accepted2/22ms2328 KiB
4Accepted2/22ms2532 KiB
5Accepted2/22ms2604 KiB
6Accepted2/22ms2608 KiB
7Accepted2/22ms2676 KiB
8Accepted2/23ms2760 KiB
9Accepted2/24ms2788 KiB
10Accepted2/26ms2920 KiB
11Accepted2/26ms3124 KiB
12Accepted2/24ms3332 KiB
13Accepted2/237ms4156 KiB
14Accepted2/235ms4204 KiB
15Accepted2/257ms4980 KiB
16Accepted2/265ms5016 KiB
17Accepted2/271ms5244 KiB
18Accepted2/274ms5348 KiB
19Accepted2/271ms5556 KiB
20Accepted2/223ms4796 KiB
21Accepted2/259ms5704 KiB
22Accepted2/271ms5808 KiB