36082023-03-01 10:06:45AblablablaInverziócpp17Time limit exceeded 10/50600ms5272 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> szamok(n, 0);
    int maxi = 0;
    int indk = -1;
    int indn = -1;
    for(int j = 0; j < n; j++){
        cin >> szamok[j];
        int nagyobb = n - szamok[j];
        for(int i = j - 1; i >= 0 && nagyobb > 0; i--){
            if(szamok[i] > szamok[j]){
                nagyobb--;
                if(j - i > maxi){
                    maxi = j - i;
                    indk = i + 1;
                    indn = j + 1;
                }
            }
        }
    }

    /*for(int i = 0; i < n; i++){
        if(maxi > n - i - 1){
            break;
        }
        for(int j = n - 1; j > i; j--){
                //cout << i << " " << j << "\n";
            if(j - i > maxi && szamok[i] > szamok[j]){
                maxi = j - i;
                indk = i + 1;
                indn = j + 1;
                //cout << indk << " " << indn << " " << maxi << "\n";
                break;
            }
        }
    }*/

    if(indn == -1 && indk == -1){
        cout << "-1";
    } else{
        cout << indk << " " << indn;
    }
}
SubtaskSumTestVerdictTimeMemory
base10/50
1Accepted0/03ms1812 KiB
2Time limit exceeded0/0600ms1592 KiB
3Accepted1/13ms2340 KiB
4Accepted2/24ms2596 KiB
5Accepted7/73ms2620 KiB
6Time limit exceeded0/2578ms2156 KiB
7Time limit exceeded0/2560ms4008 KiB
8Time limit exceeded0/2568ms4016 KiB
9Time limit exceeded0/2575ms4360 KiB
10Time limit exceeded0/2564ms4236 KiB
11Time limit exceeded0/2575ms4424 KiB
12Time limit exceeded0/2563ms4636 KiB
13Time limit exceeded0/2574ms4672 KiB
14Time limit exceeded0/2566ms4916 KiB
15Time limit exceeded0/2566ms4804 KiB
16Time limit exceeded0/2546ms4872 KiB
17Time limit exceeded0/2544ms4928 KiB
18Time limit exceeded0/2555ms4880 KiB
19Time limit exceeded0/3566ms4880 KiB
20Time limit exceeded0/3550ms5020 KiB
21Time limit exceeded0/2531ms4964 KiB
22Time limit exceeded0/2574ms5136 KiB
23Time limit exceeded0/2578ms5272 KiB
24Time limit exceeded0/2536ms5168 KiB