219422026-01-14 10:55:55BravoFasor (40)cpp17Wrong answer 0/401ms540 KiB
#include <iostream>
#include <fstream>
using namespace std;

int main()
{
    ifstream f("fa.txt");
    int n,k;
    f >> n >> k;
    int a[n];
    for(int i=0;i<n;i++){
        f >> a[i];
    }
    int b[k*2];
    for(int i=0;i<k*2;i++){
        b[i]=0;
    }
    int c=0,o=0;
    for(int i=0;i<n;i++){
        if(i==0){
            for(int j=1;j<k-1;j++){
               if(a[j]<=a[i]){
                b[o]=1;
               }
               o++;
            }
            for(int j=0;j<k;j++){
                if(b[j]==0){
                    c++;
                }
            }
            if(c==0){
                cout << i+1;
                return 0;
            }
        }
        else if(i+1==n){
            for(int j=i-1;j>i-k+1;j--){
                if(a[j]<=a[i]){
                    b[o]=1;
                }
                o++;
            }
            for(int j=0;j<k;j++){
                if(b[j]==0){
                    c++;
                }
            }
            if(c==0){
                cout << i+1;
                return 0;
            }
        }
        else{
            for(int j=i+1;j<i+k+1;j++){
                if(a[j]<=a[i]){
                    b[o]=1;
                }
                o++;
            }
            for(int j=i-1;j>i-k-1;j--){
                if(a[j]<=a[i]){
                    b[o]=1;
                }
                o++;
            }
            for(int j=0;j<k*2;j++){
                if(b[j]==0){
                    c++;
                }
            }
            if(c==0){
                cout << i+1;
                return 0;
            }
        }
        c=0;
        o=0;
        for(int j=0;j<k*2;j++){
            b[j]=0;
        }

    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/40
1Wrong answer0/01ms316 KiB
2Wrong answer0/01ms500 KiB
3Wrong answer0/21ms500 KiB
4Wrong answer0/21ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/21ms500 KiB
7Wrong answer0/21ms316 KiB
8Wrong answer0/21ms316 KiB
9Wrong answer0/21ms316 KiB
10Wrong answer0/21ms316 KiB
11Wrong answer0/21ms316 KiB
12Wrong answer0/21ms508 KiB
13Wrong answer0/21ms508 KiB
14Wrong answer0/21ms540 KiB
15Wrong answer0/21ms316 KiB
16Wrong answer0/21ms316 KiB
17Wrong answer0/21ms508 KiB
18Wrong answer0/21ms316 KiB
19Wrong answer0/21ms512 KiB
20Wrong answer0/21ms500 KiB
21Wrong answer0/21ms316 KiB
22Wrong answer0/21ms536 KiB