127892024-12-30 18:16:18birozsInverziócpp11Time limit exceeded 12/50583ms596 KiB
#include <iostream>

using namespace std;

int main()
{
    int N;
    cin >> N;
    int T[50000];
    for (int i=0;i<N;i++) {
        cin >> T[i];
    }
    int maxhossz = 0;
    int maxkezdo,maxveg,j;
    for (int i=0;i<N-1;i++) {
        if (T[i] > i+1) {
            j = N - 1;
            while (i < j && T[i] < T[j]) {
                j--;
            }
            if (j-i>maxhossz) {
                maxhossz = j - i;
                maxkezdo = i + 1;
                maxveg = j + 1;
            }
        }
    }
    if (maxhossz == 0) {
        cout << -1;
    }
    else {
        cout << maxkezdo << " " << maxveg;
    }






    return 0;
}
SubtaskSumTestVerdictTimeMemory
base12/50
1Accepted0/01ms320 KiB
2Time limit exceeded0/0583ms504 KiB
3Accepted1/11ms320 KiB
4Accepted2/21ms324 KiB
5Accepted7/71ms320 KiB
6Accepted2/2456ms596 KiB
7Runtime error0/217ms572 KiB
8Runtime error0/217ms536 KiB
9Runtime error0/218ms568 KiB
10Runtime error0/218ms568 KiB
11Runtime error0/217ms568 KiB
12Runtime error0/217ms568 KiB
13Runtime error0/217ms568 KiB
14Runtime error0/217ms568 KiB
15Runtime error0/217ms568 KiB
16Runtime error0/218ms584 KiB
17Runtime error0/217ms596 KiB
18Runtime error0/217ms568 KiB
19Runtime error0/317ms556 KiB
20Runtime error0/317ms468 KiB
21Runtime error0/217ms544 KiB
22Runtime error0/217ms568 KiB
23Runtime error0/218ms568 KiB
24Runtime error0/217ms568 KiB