51202023-04-18 16:21:44Tina0731Legmesszebbi rossz sorrendű (35 pont)cpp11Wrong answer 23/35270ms5192 KiB
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int t[n+1];
    cin>>t[1];
    int ln=t[1], tav=0, hely=-1, masodik;
    for(int i=2;i<n+1;i++)

    {
        cin>>t[i];
        if(t[i]<t[1])
        {
            hely=1;
            masodik=i;
            tav=i;
        }
    }

    for(int i=1;i+tav<n+1;i++)
    {
        if(t[i]>ln)
        {
            ln=t[i];
            for(int j=n;j>i+tav;j--)
            {
                if(t[i]>t[j])
                {
                    hely=i;
                    tav=j-i+1;
                    masodik=j;
                    break;
                }
            }

        }
    }

    if(hely==-1)
        cout<<-1;
    else
        cout<<hely<<" "<<masodik;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base23/35
1Accepted0/03ms1876 KiB
2Accepted0/0112ms2908 KiB
3Accepted1/12ms2120 KiB
4Accepted1/12ms2308 KiB
5Accepted1/12ms2400 KiB
6Accepted1/12ms2396 KiB
7Accepted1/13ms2592 KiB
8Wrong answer0/13ms2660 KiB
9Wrong answer0/14ms2872 KiB
10Accepted1/14ms3084 KiB
11Accepted1/14ms3204 KiB
12Wrong answer0/2157ms3472 KiB
13Accepted2/2195ms3464 KiB
14Time limit exceeded0/2218ms3800 KiB
15Accepted2/292ms4080 KiB
16Time limit exceeded0/2238ms4100 KiB
17Accepted2/261ms4488 KiB
18Accepted2/274ms4604 KiB
19Accepted2/287ms4644 KiB
20Accepted2/292ms4944 KiB
21Accepted2/2108ms5192 KiB
22Accepted2/2112ms5044 KiB
23Time limit exceeded0/2266ms4060 KiB
24Time limit exceeded0/2270ms4196 KiB