121632024-12-06 07:35:40KissCsongor777Inverziócpp11Time limit exceeded 24/50602ms23880 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
base24/50
1Accepted0/01ms320 KiB
2Accepted0/039ms2596 KiB
3Accepted1/11ms328 KiB
4Accepted2/22ms320 KiB
5Accepted7/71ms320 KiB
6Accepted2/246ms2668 KiB
7Accepted2/2432ms23820 KiB
8Time limit exceeded0/2601ms23740 KiB
9Time limit exceeded0/2602ms23808 KiB
10Time limit exceeded0/2601ms23864 KiB
11Time limit exceeded0/2592ms23864 KiB
12Time limit exceeded0/2584ms23400 KiB
13Time limit exceeded0/2601ms23864 KiB
14Time limit exceeded0/2583ms23816 KiB
15Accepted2/2426ms23864 KiB
16Time limit exceeded0/2584ms23864 KiB
17Time limit exceeded0/2601ms23748 KiB
18Time limit exceeded0/2575ms23868 KiB
19Accepted3/3428ms23864 KiB
20Accepted3/3425ms23880 KiB
21Accepted2/2418ms23788 KiB
22Time limit exceeded0/2584ms23864 KiB
23Time limit exceeded0/2588ms23864 KiB
24Time limit exceeded0/2537ms23864 KiB