140162025-01-09 17:29:36MittomenInverziócpp17Wrong answer 9/5059ms2368 KiB
#include <list>
#include <iostream>
#include <vector>
#include <bitset>
#include <algorithm>

#define MOD ((long long) 1e9 + 7)

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin >> n;

    vector<int> elements(n+1);

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

    int max_l = elements[1];
    int max_dif = 0;
    int max_r;

    for (int i = 1; i < n+1; i++) {
        max_l = max(max_l, elements[i]);
        if (max_l - elements[i] > max_dif) {
            max_dif = max_l - elements[i];
            max_r = elements[i];
        }
    }

    if (max_dif == 0) cout << -1;
    else cout << max_r << ' ' << max_l;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base9/50
1Accepted0/01ms316 KiB
2Wrong answer0/06ms564 KiB
3Accepted1/11ms316 KiB
4Accepted2/21ms316 KiB
5Wrong answer0/71ms316 KiB
6Accepted2/26ms564 KiB
7Wrong answer0/256ms2368 KiB
8Wrong answer0/257ms2356 KiB
9Accepted2/259ms2356 KiB
10Wrong answer0/259ms2356 KiB
11Wrong answer0/259ms2356 KiB
12Wrong answer0/256ms2244 KiB
13Wrong answer0/257ms2356 KiB
14Wrong answer0/256ms2356 KiB
15Wrong answer0/256ms2356 KiB
16Wrong answer0/257ms2356 KiB
17Wrong answer0/257ms2160 KiB
18Wrong answer0/256ms2200 KiB
19Wrong answer0/357ms2356 KiB
20Wrong answer0/357ms2356 KiB
21Wrong answer0/254ms2356 KiB
22Wrong answer0/257ms2356 KiB
23Wrong answer0/257ms2356 KiB
24Accepted2/254ms2356 KiB