16552022-12-01 12:43:03bzsofiaInverziócpp11Time limit exceeded 10/50600ms5772 KiB
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int i, n, a, tav, tavi, tavj, j;

int main()
{
    cin>>n;

    vector <int> x(n+1);

    for (i=1; i<=n; ++i) cin>>x[i];

    i=1;
    j=n;
    tav=0;
    while (i<n && j>1)
    {
        if (tav>=j-i)
        {
            ++i;
            j=n;
        }else if (x[i]>x[j])
        {
            tav=j-i;
            tavi=i;
            tavj=j;
            ++i;
            j=n;
        }else if (i+1==j)
        {
            ++i;
            j=n;
        }else --j;
    }

    if (tav==0) cout<<-1;
    else cout<<tavi<<" "<<tavj;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base10/50
1Accepted0/03ms1812 KiB
2Time limit exceeded0/0560ms1420 KiB
3Accepted1/12ms2180 KiB
4Accepted2/22ms2392 KiB
5Accepted7/73ms2636 KiB
6Time limit exceeded0/2600ms2256 KiB
7Time limit exceeded0/2569ms4252 KiB
8Time limit exceeded0/2578ms4500 KiB
9Time limit exceeded0/2550ms4344 KiB
10Time limit exceeded0/2554ms4472 KiB
11Time limit exceeded0/2549ms4524 KiB
12Time limit exceeded0/2546ms4656 KiB
13Time limit exceeded0/2560ms4604 KiB
14Time limit exceeded0/2561ms4920 KiB
15Time limit exceeded0/2550ms4812 KiB
16Time limit exceeded0/2550ms5072 KiB
17Time limit exceeded0/2561ms5480 KiB
18Time limit exceeded0/2565ms5556 KiB
19Time limit exceeded0/3558ms5508 KiB
20Time limit exceeded0/3565ms5508 KiB
21Time limit exceeded0/2537ms5708 KiB
22Time limit exceeded0/2569ms5680 KiB
23Time limit exceeded0/2582ms5608 KiB
24Time limit exceeded0/2578ms5772 KiB