79422024-01-12 08:09:15TundeInverziócpp17Time limit exceeded 3/50602ms9388 KiB
#include <iostream>

using namespace std;

struct szam
{
    int e, h, i;
};

int main()
{
    int n;
    cin >> n;
    szam t[n];
    for(int i=0; i<n; i++)
    {
        cin >> t[i].e;
    }
    int lh=-1, x=1, y=1;
    for(int i=0; i<n-1; i++)
    {
        int x=0;
        for(int j=n-1; j>i && x==0; j--)
        {
            if(t[j].e<t[i].e)
            {
                t[i].h=j-i;
                t[i].i=j;
                ++x;
            }
        }
        if(x==0)
        {
            t[i].h=0;
        }
        if(t[i].h>lh)
        {
            lh=t[i].h;
            x=i+1;
            y=(t[i].i+1);
        }
    }
    if(lh==-1)
    {
        cout << -1;
    }
    else
        cout << x << " " << y;
}
SubtaskSumTestVerdictTimeMemory
base3/50
1Accepted0/03ms1876 KiB
2Time limit exceeded0/0560ms3344 KiB
3Accepted1/13ms2280 KiB
4Accepted2/23ms2496 KiB
5Wrong answer0/73ms2740 KiB
6Wrong answer0/2333ms4072 KiB
7Time limit exceeded0/2600ms7896 KiB
8Time limit exceeded0/2570ms8192 KiB
9Time limit exceeded0/2518ms8088 KiB
10Time limit exceeded0/2555ms8196 KiB
11Time limit exceeded0/2570ms8392 KiB
12Time limit exceeded0/2602ms8220 KiB
13Time limit exceeded0/2559ms8292 KiB
14Time limit exceeded0/2570ms8692 KiB
15Time limit exceeded0/2570ms8716 KiB
16Time limit exceeded0/2563ms8532 KiB
17Time limit exceeded0/2570ms8860 KiB
18Time limit exceeded0/2546ms8848 KiB
19Time limit exceeded0/3570ms9120 KiB
20Time limit exceeded0/3538ms8992 KiB
21Time limit exceeded0/2578ms9140 KiB
22Time limit exceeded0/2578ms9060 KiB
23Time limit exceeded0/2558ms9388 KiB
24Time limit exceeded0/2550ms9336 KiB