67402023-12-18 12:49:05madvirInverziócpp17Time limit exceeded 11/50600ms5876 KiB
#include <iostream>

using namespace std;

int main()
{
    int n, tav=0, e, u, maxtav=0;
    cin >> n;
    int a[n];

    for(int i=0; i<n; i++) {
        cin >> a[i];
    }

    int z=0, x=n-1;
    while(z<n-1) {
        while(a[z]<a[x]&& x!=z) {
            x--;
        }
        if(x==z) {
            z++;
            x=n-1;
        }
        else {
            tav=x-z;
            if(tav>maxtav) {
                maxtav=tav;
                e=z;
                u=x;
            }
            z++;
            x=n-1;
        }
    }
    cout << ++e << " " << ++u;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base11/50
1Accepted0/03ms1880 KiB
2Time limit exceeded0/0600ms1544 KiB
3Wrong answer0/13ms2276 KiB
4Accepted2/23ms2528 KiB
5Accepted7/73ms2636 KiB
6Accepted2/2407ms3308 KiB
7Time limit exceeded0/2559ms4308 KiB
8Time limit exceeded0/2542ms4344 KiB
9Time limit exceeded0/2566ms4624 KiB
10Time limit exceeded0/2578ms4708 KiB
11Time limit exceeded0/2555ms4872 KiB
12Time limit exceeded0/2546ms4960 KiB
13Time limit exceeded0/2574ms5148 KiB
14Time limit exceeded0/2570ms5264 KiB
15Time limit exceeded0/2559ms5300 KiB
16Time limit exceeded0/2569ms5304 KiB
17Time limit exceeded0/2565ms5392 KiB
18Time limit exceeded0/2565ms5668 KiB
19Time limit exceeded0/3565ms5588 KiB
20Time limit exceeded0/3582ms5536 KiB
21Time limit exceeded0/2558ms5428 KiB
22Time limit exceeded0/2561ms5580 KiB
23Time limit exceeded0/2561ms5792 KiB
24Time limit exceeded0/2569ms5876 KiB