51252023-04-18 16:55:09KCsengeLegmesszebbi rossz sorrendű (35 pont)cpp14Time limit exceeded 8/35300ms5028 KiB
#include <iostream>
#include <bits/stdc++.h>
using namespace std;

/*
10
7 2 4 17 6 5 10 10 18 19
*/
int main()
{
    long long int i,n,s=0,e,m,elso, masodik,maxr,hanyadik;
    cin>>n;
    long long int tomb[n];
    cin>>tomb[0];

    for(i=1; i<n;i++)
    {
        cin>>tomb[i];
        if(tomb[0]>tomb[i])
        {
            hanyadik=i;
            e=0;
            m=i;
        }
    }
    s=hanyadik;
   // cout<<s<<endl;

   int t=tomb[0];
    for(i=1;i<n-1;i++)
    {
       if(t<tomb[i])
        {
            for(long long j=n-1;j>=i+s;j--)
        {
            if(tomb[i]>tomb[j])
            {
                elso=i;
                masodik=j;
                maxr=masodik-elso;
                if(maxr>s)
                {
                    e=i;
                    m=j;
                    s=maxr;
                }
                break;
            }
        }
        }
        t=tomb[i];
    }

   // cout <<s<<endl;
   if(s==0)
    cout<<-1;
   else
    cout<<e+1<<" "<<m+1;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base8/35
1Accepted0/03ms1876 KiB
2Time limit exceeded0/0300ms2096 KiB
3Wrong answer0/13ms2280 KiB
4Accepted1/13ms2636 KiB
5Wrong answer0/13ms2716 KiB
6Wrong answer0/13ms2952 KiB
7Accepted1/13ms3140 KiB
8Accepted1/13ms3352 KiB
9Accepted1/14ms3476 KiB
10Accepted1/14ms3604 KiB
11Accepted1/16ms3832 KiB
12Time limit exceeded0/2209ms4460 KiB
13Time limit exceeded0/2266ms4784 KiB
14Time limit exceeded0/2247ms3832 KiB
15Accepted2/2122ms4632 KiB
16Time limit exceeded0/2270ms3836 KiB
17Time limit exceeded0/2275ms4060 KiB
18Time limit exceeded0/2268ms4056 KiB
19Time limit exceeded0/2256ms4500 KiB
20Time limit exceeded0/2275ms4584 KiB
21Time limit exceeded0/2263ms4748 KiB
22Time limit exceeded0/2268ms5028 KiB
23Time limit exceeded0/2270ms4816 KiB
24Time limit exceeded0/2250ms4820 KiB