60102023-10-18 16:33:48Tina0731Inverziócpp14Time limit exceeded 0/50582ms7352 KiB
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int t[n+1];
    int hol[n+1];
    for(int i=1;i<=n;i++)
    {
        cin>>t[i];
        hol[t[i]]=i;
    }

    int lh=-1;
    int a, b;
    for(int i=1;i<=n;i++)
    {
        for(int j=t[i];j>0;j++)
        {
            if(hol[j]>hol[t[i]] && hol[j]-hol[t[i]]>lh)
            {
                lh=hol[j]-hol[t[i]];
                a=hol[t[i]];
                b=hol[j];
            }
        }
    }
    if(lh!=-1)
        cout<<a<<" "<<b;
    else
        cout<<-1;





    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Time limit exceeded0/0565ms892 KiB
2Time limit exceeded0/0574ms1676 KiB
3Time limit exceeded0/1577ms2144 KiB
4Time limit exceeded0/2556ms2216 KiB
5Time limit exceeded0/7556ms1564 KiB
6Time limit exceeded0/2554ms2176 KiB
7Time limit exceeded0/2541ms5832 KiB
8Time limit exceeded0/2564ms5740 KiB
9Time limit exceeded0/2582ms6048 KiB
10Time limit exceeded0/2582ms6200 KiB
11Time limit exceeded0/2582ms6580 KiB
12Time limit exceeded0/2550ms6480 KiB
13Time limit exceeded0/2561ms6308 KiB
14Time limit exceeded0/2546ms6680 KiB
15Time limit exceeded0/2574ms6596 KiB
16Time limit exceeded0/2578ms6804 KiB
17Time limit exceeded0/2561ms6908 KiB
18Time limit exceeded0/2574ms7160 KiB
19Time limit exceeded0/3565ms7052 KiB
20Time limit exceeded0/3546ms7060 KiB
21Time limit exceeded0/2560ms7300 KiB
22Time limit exceeded0/2573ms7256 KiB
23Time limit exceeded0/2570ms7268 KiB
24Time limit exceeded0/2550ms7352 KiB