51232023-04-18 16:46:33KCsengeLegmesszebbi rossz sorrendű (35 pont)cpp14Time limit exceeded 8/35300ms4396 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;

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

   // 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/0300ms2092 KiB
3Wrong answer0/13ms2364 KiB
4Accepted1/13ms2572 KiB
5Accepted1/13ms2608 KiB
6Accepted1/13ms2812 KiB
7Accepted1/12ms2892 KiB
8Accepted1/13ms3012 KiB
9Accepted1/14ms3016 KiB
10Accepted1/16ms3152 KiB
11Accepted1/18ms3376 KiB
12Time limit exceeded0/2252ms2768 KiB
13Time limit exceeded0/2268ms3100 KiB
14Time limit exceeded0/2246ms3184 KiB
15Time limit exceeded0/2229ms4364 KiB
16Time limit exceeded0/2266ms3532 KiB
17Time limit exceeded0/2244ms3640 KiB
18Time limit exceeded0/2263ms3680 KiB
19Time limit exceeded0/2256ms3972 KiB
20Time limit exceeded0/2259ms3944 KiB
21Time limit exceeded0/2248ms4068 KiB
22Time limit exceeded0/2256ms4016 KiB
23Time limit exceeded0/2239ms4244 KiB
24Time limit exceeded0/2252ms4396 KiB