140262025-01-09 17:38:45BalintInverziócpp17Wrong answer 6/5063ms2548 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;cin >> n;
    vector<int> v(n+1);
    for(int i = 0; i < n; i++)
    {
        int index;cin >> index;
        v[index] = i+1;
    }
    int maxI = -1;int maxGap = -1;
    for(int i: v)
    {
        maxGap = max(maxGap, maxI - i);
        maxI = max(maxI, i);
    }
    if(maxGap == 0)
    {
        cout << -1;
    }
    else
    {
        cout << abs(maxI - maxGap) << " " << maxI;
    }

    return 0;

    // 5
    // 4 3 5 1 2
    // 4 5 2 1 3

}
SubtaskSumTestVerdictTimeMemory
base6/50
1Accepted0/01ms316 KiB
2Wrong answer0/07ms564 KiB
3Wrong answer0/11ms508 KiB
4Accepted2/21ms316 KiB
5Wrong answer0/71ms316 KiB
6Accepted2/26ms564 KiB
7Wrong answer0/261ms2360 KiB
8Wrong answer0/261ms2356 KiB
9Accepted2/261ms2356 KiB
10Wrong answer0/261ms2356 KiB
11Wrong answer0/263ms2356 KiB
12Wrong answer0/259ms2100 KiB
13Wrong answer0/261ms2356 KiB
14Wrong answer0/259ms2356 KiB
15Wrong answer0/259ms2356 KiB
16Wrong answer0/261ms2368 KiB
17Wrong answer0/261ms2356 KiB
18Wrong answer0/259ms2356 KiB
19Wrong answer0/359ms2356 KiB
20Wrong answer0/359ms2360 KiB
21Wrong answer0/259ms2356 KiB
22Wrong answer0/259ms2360 KiB
23Wrong answer0/261ms2548 KiB
24Wrong answer0/259ms2356 KiB