121652024-12-06 07:39:55KissCsongor777Inverziócpp11Time limit exceeded 24/50601ms23868 KiB
#include<bits/stdc++.h>

using namespace std;

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

    }
    if(a!=0)cout<<a<<" "<<b;
    else cout<<-1;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base24/50
1Accepted0/01ms320 KiB
2Accepted0/037ms2616 KiB
3Accepted1/11ms320 KiB
4Accepted2/22ms320 KiB
5Accepted7/71ms320 KiB
6Accepted2/246ms2592 KiB
7Accepted2/2418ms23868 KiB
8Time limit exceeded0/2601ms23700 KiB
9Time limit exceeded0/2592ms23864 KiB
10Time limit exceeded0/2601ms23824 KiB
11Time limit exceeded0/2588ms23860 KiB
12Time limit exceeded0/2579ms23352 KiB
13Time limit exceeded0/2601ms23808 KiB
14Time limit exceeded0/2586ms23864 KiB
15Accepted2/2418ms23864 KiB
16Time limit exceeded0/2589ms23864 KiB
17Time limit exceeded0/2592ms23864 KiB
18Time limit exceeded0/2601ms23864 KiB
19Accepted3/3418ms23864 KiB
20Accepted3/3430ms23864 KiB
21Accepted2/2416ms23824 KiB
22Time limit exceeded0/2584ms23864 KiB
23Time limit exceeded0/2587ms23792 KiB
24Time limit exceeded0/2529ms23720 KiB