78402024-01-11 12:53:11TundeFasor (40)cpp17Wrong answer 10/40300ms7068 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)
                    {
                        ++d;
                    }
                    else
                        ++x;
                }
                if(d>=k)
                    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=1; (j<=k && w==0) && j<n-i; j++)
            {
                if(t[i+j].m>t[i].m)
                    ++w;
            }
            if(w==0)
            {
                ++x;
                cout << i+1;
            }
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base10/40
1Accepted0/03ms1876 KiB
2Accepted0/06ms2320 KiB
3Wrong answer0/23ms2332 KiB
4Accepted2/23ms2488 KiB
5Wrong answer0/23ms2700 KiB
6Accepted2/23ms2912 KiB
7Wrong answer0/23ms3000 KiB
8Accepted2/23ms3020 KiB
9Wrong answer0/26ms3324 KiB
10Accepted2/27ms3288 KiB
11Accepted2/28ms3288 KiB
12Wrong answer0/24ms3284 KiB
13Time limit exceeded0/2300ms3200 KiB
14Time limit exceeded0/2270ms3376 KiB
15Time limit exceeded0/2254ms4408 KiB
16Time limit exceeded0/2246ms4444 KiB
17Time limit exceeded0/2268ms4488 KiB
18Time limit exceeded0/2261ms4396 KiB
19Time limit exceeded0/2270ms4420 KiB
20Time limit exceeded0/2250ms3752 KiB
21Time limit exceeded0/2254ms4536 KiB
22Wrong answer0/286ms7068 KiB