69942023-12-24 15:14:58MagyarKendeSZLGInverziócpp17Time limit exceeded 16/50578ms7596 KiB
#include <iostream>
#include <vector>
#include <array>
using namespace std;
#define speed cin.tie(0); ios::sync_with_stdio(0)

using point = array<int, 2>;

int main() {
    speed;

    int N;
    cin >> N;
    vector<int> v(N);
    bool in_order = true;
    for (int i = 0; i < N; i++) {
        cin >> v[i];
        if (v[i] < v[i - 1]) in_order = false;
    }
    if (in_order) {
        cout << -1;
        exit(0);
    }
    point p {0, 0};
    for (int l = N; l > 0; l--) {
        for (int i = 0, j = l - 1; j < N; i++, j++) {
            if (v[i] > v[j]) {
                cout << i + 1 << ' ' << j + 1;
                exit(0);
            }
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base16/50
1Accepted0/03ms1828 KiB
2Time limit exceeded0/0535ms2472 KiB
3Accepted1/13ms2296 KiB
4Accepted2/23ms2384 KiB
5Accepted7/73ms2456 KiB
6Accepted2/2201ms2852 KiB
7Time limit exceeded0/2531ms3764 KiB
8Time limit exceeded0/2533ms3912 KiB
9Accepted2/264ms6752 KiB
10Time limit exceeded0/2578ms4028 KiB
11Time limit exceeded0/2550ms4288 KiB
12Time limit exceeded0/2556ms4268 KiB
13Time limit exceeded0/2573ms4292 KiB
14Time limit exceeded0/2574ms4824 KiB
15Time limit exceeded0/2558ms4848 KiB
16Time limit exceeded0/2523ms4764 KiB
17Time limit exceeded0/2578ms4780 KiB
18Time limit exceeded0/2564ms4712 KiB
19Time limit exceeded0/3554ms4924 KiB
20Time limit exceeded0/3550ms4708 KiB
21Time limit exceeded0/2558ms4780 KiB
22Time limit exceeded0/2554ms4696 KiB
23Time limit exceeded0/2578ms4948 KiB
24Accepted2/257ms7596 KiB