121622024-12-06 07:35:32KissCsongor777Inverziópython3Runtime error 0/5016ms3064 KiB
#include<bits/stdc++.h>
#include<cmath>
using namespace std;

int main()
{
    int N, x, m=-2147483647,a=0,b;
    cin>>N;
    map<int,int> H;
    for(int i=1; i<=N; i++)
    {
        cin>>x;
        H[x]=i;
    }
    x=1;
    for(int i=2; i<=H.size(); i++)
    {
        if(H[i]<H[x])
        {if(H[x]-H[i]>m){m=H[x]-H[i]; a=H[i]; b=H[x];}}
        else x=i;

    }
    if(a!=0)cout<<a<<" "<<b;
    else cout<<-1;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Runtime error0/016ms2876 KiB
2Runtime error0/014ms2868 KiB
3Runtime error0/114ms3048 KiB
4Runtime error0/214ms2960 KiB
5Runtime error0/714ms2872 KiB
6Runtime error0/216ms2872 KiB
7Runtime error0/214ms3016 KiB
8Runtime error0/214ms2872 KiB
9Runtime error0/216ms2912 KiB
10Runtime error0/216ms3056 KiB
11Runtime error0/214ms3064 KiB
12Runtime error0/216ms2820 KiB
13Runtime error0/216ms2880 KiB
14Runtime error0/216ms2868 KiB
15Runtime error0/216ms2872 KiB
16Runtime error0/216ms2864 KiB
17Runtime error0/214ms3016 KiB
18Runtime error0/214ms2876 KiB
19Runtime error0/314ms3044 KiB
20Runtime error0/316ms2872 KiB
21Runtime error0/214ms2856 KiB
22Runtime error0/214ms3036 KiB
23Runtime error0/214ms2872 KiB
24Runtime error0/216ms2976 KiB