77072024-01-10 14:13:01PeterInverziócpp17Runtime error 10/508ms4328 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int N;
    vector<int> sorozat(N);
    cin >> N;
    for (int i = 0; i < N; i++){
        cin >> sorozat[i];
    }

    int maxinverzio = 0;
    int maxhelykezd = -1;
    int maxhelyveg = -1;
    for (int i = 0; i < N; i++) {
        for (int j = i; j < N; j++) //Ilyenkor az i mindig kisebb lesz, mint j?
        {
            if (sorozat[i]>sorozat[j]&&j-i>maxinverzio) {
                maxinverzio = j-i;
                maxhelykezd = i;
                maxhelyveg = j;

                //cout << maxinverzio << " " << maxhelykezd << " " << maxhelyveg << "\n";



            }
        }
    }

    if (maxhelykezd==-1) {
        cout << -1;
    }
    else {
        cout << maxhelykezd+1 << " " << maxhelyveg+1;
    }


}
SubtaskSumTestVerdictTimeMemory
base10/50
1Accepted0/03ms1812 KiB
2Runtime error0/04ms2100 KiB
3Accepted1/13ms2216 KiB
4Accepted2/24ms2460 KiB
5Accepted7/74ms2636 KiB
6Runtime error0/24ms3228 KiB
7Runtime error0/28ms3224 KiB
8Runtime error0/28ms3416 KiB
9Runtime error0/28ms3504 KiB
10Runtime error0/28ms3352 KiB
11Runtime error0/27ms3348 KiB
12Runtime error0/27ms3604 KiB
13Runtime error0/28ms3784 KiB
14Runtime error0/28ms3692 KiB
15Runtime error0/28ms3820 KiB
16Runtime error0/28ms3904 KiB
17Runtime error0/27ms3988 KiB
18Runtime error0/27ms4240 KiB
19Runtime error0/38ms4220 KiB
20Runtime error0/38ms4048 KiB
21Runtime error0/28ms4328 KiB
22Runtime error0/27ms4200 KiB
23Runtime error0/27ms4180 KiB
24Runtime error0/28ms4180 KiB