50782023-04-15 07:52:52AncsaLegmesszebbi rossz sorrendű (35 pont)cpp11Time limit exceeded 8/35300ms4064 KiB
#include <bits/stdc++.h>
//Nemes Tihamer orszagos feladat
//Tesztelheto
//https://njudge.hu/problemset/main/NT23_Legmesszebbi/

using namespace std;
/*
be
10
7 2 4 17 6 5 10 10 18 19
ki
i 6
*/

/*
be
12
2 4 7 11 9 6 3 2 8 4 6 10

ki
3 11

*/


int main()
{
    srand(time(0));
    int n;
    cin>>n;
    vector<int> a(n);
    int eleje=0, vege=0,uj;
    for(int i=0;i<n;i++)
    {
        cin>>a.at(i);
        if(a.at(i)<a.at(0))
        {
            vege=i;
        }
    }
    /*
    for(int i=0;i<n;i++)
    {
        cout<<a.at(i)<<"\t";
        if(i%10==9)
            cout<<endl;
    }
    */
    int tav=vege;
    //cout<<vege<<endl;
    for(int i=1;i<n-tav;i++)
    {
        for(int j=n-1;j>=i+tav+1;j--)
        {
      //      cout<<"lepes:"<<i<<" "<<j<<endl;

            if(a.at(j)<a.at(i))
            {
                eleje=i;
                vege=j;
                tav=j-i;
        //        cout<<eleje<<" "<<vege<<endl;
            }
        }
    }

    cout << eleje+1<<" "<<vege+1 << endl;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base8/35
1Accepted0/03ms1680 KiB
2Time limit exceeded0/0300ms1584 KiB
3Wrong answer0/13ms2144 KiB
4Accepted1/13ms2388 KiB
5Accepted1/13ms2516 KiB
6Accepted1/12ms2572 KiB
7Accepted1/13ms2696 KiB
8Accepted1/13ms2916 KiB
9Accepted1/14ms3124 KiB
10Accepted1/17ms3216 KiB
11Accepted1/110ms3348 KiB
12Time limit exceeded0/2300ms2768 KiB
13Time limit exceeded0/2266ms2848 KiB
14Time limit exceeded0/2272ms2912 KiB
15Time limit exceeded0/2263ms3512 KiB
16Time limit exceeded0/2231ms3972 KiB
17Time limit exceeded0/2270ms3172 KiB
18Time limit exceeded0/2263ms3472 KiB
19Time limit exceeded0/2270ms3640 KiB
20Time limit exceeded0/2279ms3764 KiB
21Time limit exceeded0/2236ms3776 KiB
22Time limit exceeded0/2263ms3928 KiB
23Time limit exceeded0/2256ms4020 KiB
24Time limit exceeded0/2263ms4064 KiB