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

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/01ms500 KiB
2Accepted0/039ms2616 KiB
3Accepted1/11ms320 KiB
4Accepted2/22ms500 KiB
5Accepted7/71ms436 KiB
6Accepted2/246ms2516 KiB
7Accepted2/2433ms23824 KiB
8Time limit exceeded0/2601ms23864 KiB
9Time limit exceeded0/2587ms23864 KiB
10Time limit exceeded0/2601ms23868 KiB
11Time limit exceeded0/2593ms23864 KiB
12Time limit exceeded0/2587ms23352 KiB
13Time limit exceeded0/2601ms23708 KiB
14Time limit exceeded0/2583ms23864 KiB
15Accepted2/2414ms23864 KiB
16Time limit exceeded0/2592ms23864 KiB
17Time limit exceeded0/2601ms23644 KiB
18Time limit exceeded0/2589ms23864 KiB
19Accepted3/3416ms23796 KiB
20Accepted3/3430ms23864 KiB
21Accepted2/2423ms23864 KiB
22Time limit exceeded0/2593ms23704 KiB
23Time limit exceeded0/2589ms23796 KiB
24Time limit exceeded0/2540ms23864 KiB