60242023-10-25 16:07:31KCsengeInverziócpp14Time limit exceeded 14/50574ms7148 KiB
#include <iostream>

using namespace std;

int main()
{
    int n,i,j=0;
    cin>>n;
    int tomb[n+1];
    int b=1,jobb=n;
    for(i=1;i<=n;i++)
    {
        cin>>tomb[i];
    }
   if(tomb[b]>tomb[jobb])
        {
            cout<<b<< " "<<n;
            j=1;
        }
    else
    for(i=1;i<n-1;i++)
    {
        jobb=n-i;
        b=1;
          while(tomb[b]<=tomb[jobb]&&jobb<=n)
         {
            /*cout<<i<<" "<<b<<" "<<jobb<<" "<<endl;
            cout<<b<< "bb "<<n<<endl;
            */
           b++;
           jobb++;
           /*
           cout<<i<<" "<<b<<" "<<jobb<<" "<<endl;
           cout<<b<< "bb "<<n<<endl;
           if(tomb[b]>tomb[jobb])
           {
            cout<<b<< "bb "<<n;
            j=1;
            break;
           }
           */
         }
         if(tomb[b]>tomb[jobb]&&jobb<=n)
           {
            cout<<b<< " "<<jobb;
            j=1;
            break;
           }

    }
    if(j==0)
    cout<<-1;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base14/50
1Accepted0/03ms1748 KiB
2Time limit exceeded0/0546ms2564 KiB
3Accepted1/13ms2244 KiB
4Accepted2/23ms2332 KiB
5Accepted7/73ms2584 KiB
6Accepted2/2211ms3244 KiB
7Time limit exceeded0/2555ms4200 KiB
8Time limit exceeded0/2569ms4324 KiB
9Accepted2/2188ms7148 KiB
10Time limit exceeded0/2574ms4548 KiB
11Time limit exceeded0/2561ms4756 KiB
12Time limit exceeded0/2554ms4884 KiB
13Time limit exceeded0/2541ms5088 KiB
14Time limit exceeded0/2550ms5248 KiB
15Time limit exceeded0/2550ms5232 KiB
16Time limit exceeded0/2561ms5348 KiB
17Time limit exceeded0/2569ms5408 KiB
18Time limit exceeded0/2565ms5340 KiB
19Time limit exceeded0/3569ms5476 KiB
20Time limit exceeded0/3554ms5608 KiB
21Time limit exceeded0/2565ms5692 KiB
22Time limit exceeded0/2561ms5792 KiB
23Time limit exceeded0/2569ms6064 KiB
24Time limit exceeded0/2574ms6124 KiB