130982025-01-06 14:31:19lacitoInverziócpp17Időlimit túllépés 12/50600ms2548 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> s(n + 1);
    int maxdist = 0, maxi = -1, maxj = -1;
    for (int i = 1; i <= n; i++) cin >> s[i];
    for (int i = 1; i <= n; i++) {
        for (int j = n; j > i; j--) {
            if (s[j] < s[i]) {
                if (j - i > maxdist) {
                    maxdist = j - i;
                    maxi = i;
                    maxj = j;
                }
                break;
            }
        }
    }
    if (maxdist > 0) cout << maxi << " " << maxj << "\n";
    else cout << "-1\n";
    return 0;
}
/*
5
4 3 5 1 2
*/
RészfeladatÖsszpontTesztVerdiktIdőMemória
base12/50
1Elfogadva0/01ms512 KiB
2Időlimit túllépés0/0522ms564 KiB
3Elfogadva1/11ms316 KiB
4Elfogadva2/21ms316 KiB
5Elfogadva7/71ms316 KiB
6Elfogadva2/2310ms604 KiB
7Időlimit túllépés0/2600ms2356 KiB
8Időlimit túllépés0/2600ms2356 KiB
9Időlimit túllépés0/2592ms2356 KiB
10Időlimit túllépés0/2589ms2356 KiB
11Időlimit túllépés0/2586ms2356 KiB
12Időlimit túllépés0/2600ms2100 KiB
13Időlimit túllépés0/2591ms2356 KiB
14Időlimit túllépés0/2588ms2356 KiB
15Időlimit túllépés0/2582ms2356 KiB
16Időlimit túllépés0/2600ms2356 KiB
17Időlimit túllépés0/2579ms2356 KiB
18Időlimit túllépés0/2587ms2356 KiB
19Időlimit túllépés0/3586ms2356 KiB
20Időlimit túllépés0/3600ms2268 KiB
21Időlimit túllépés0/2582ms2548 KiB
22Időlimit túllépés0/2580ms2548 KiB
23Időlimit túllépés0/2591ms2548 KiB
24Időlimit túllépés0/2600ms2356 KiB