78422024-01-11 12:58:44TundeFasor (40)cpp17Wrong answer 18/40300ms7312 KiB
#include <iostream>
#include <cmath>

using namespace std;

struct fa
{
    int m, e;
};

int main()
{
    int n, k;
    cin >> n >> k;
    fa t[n];
    for(int i=0; i<n; i++)
    {
        cin >> t[i].m;
        t[i].e=0;
        if(i!=0)
        {
            int x=0;
            if(t[i].m>=t[i-1].m && t[i-1].e==1)
            {
                t[i].e=1;
            }
            else
            {
                int d=0;
                for(int j=i-1; (j>=0 && j>=i-k) && x==0; j--)
                {
                    if(t[j].m>t[i].m)
                        ++x;
                }
                if(x==0)
                    t[i].e=1;
                else
                    t[i].e=0;
            }
        }
    }
    int x=0;
    for(int i=0; i<n && x==0; i++)
    {
        if(t[i].e==1)
        {
            int w=0;
            for(int j=i+1; (j<=i+k && w==0) && j<n; j++)
            {
                if(t[j].m>t[i].m)
                    ++w;
            }
            if(w==0)
            {
                ++x;
                cout << i+1;
            }
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base18/40
1Accepted0/03ms1876 KiB
2Accepted0/06ms2316 KiB
3Accepted2/23ms2328 KiB
4Accepted2/23ms2532 KiB
5Wrong answer0/23ms2704 KiB
6Accepted2/23ms2916 KiB
7Accepted2/23ms3008 KiB
8Accepted2/23ms3144 KiB
9Wrong answer0/26ms3436 KiB
10Accepted2/26ms3288 KiB
11Accepted2/26ms3292 KiB
12Accepted2/24ms3544 KiB
13Time limit exceeded0/2300ms3504 KiB
14Time limit exceeded0/2279ms3812 KiB
15Time limit exceeded0/2270ms4476 KiB
16Time limit exceeded0/2257ms4716 KiB
17Time limit exceeded0/2261ms4972 KiB
18Time limit exceeded0/2241ms4896 KiB
19Time limit exceeded0/2261ms5012 KiB
20Time limit exceeded0/2254ms4156 KiB
21Time limit exceeded0/2277ms4924 KiB
22Accepted2/282ms7312 KiB