140152025-01-09 17:29:08BalintInverziócpp17Wrong answer 6/5057ms2396 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 = 0;int maxGap = 0;
    for(int i: v)
    {
        maxI = max(maxI, i);
        maxGap = max(maxGap, maxI - i);
    }
    cout << abs(maxI - maxGap) << " " << maxI;
    return 0;

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

}
SubtaskSumTestVerdictTimeMemory
base6/50
1Accepted0/01ms508 KiB
2Wrong answer0/06ms748 KiB
3Wrong answer0/11ms316 KiB
4Accepted2/21ms316 KiB
5Wrong answer0/71ms316 KiB
6Accepted2/26ms564 KiB
7Wrong answer0/254ms2356 KiB
8Wrong answer0/257ms2220 KiB
9Accepted2/257ms2356 KiB
10Wrong answer0/257ms2356 KiB
11Wrong answer0/257ms2356 KiB
12Wrong answer0/254ms2100 KiB
13Wrong answer0/257ms2356 KiB
14Wrong answer0/256ms2356 KiB
15Wrong answer0/254ms2396 KiB
16Wrong answer0/257ms2368 KiB
17Wrong answer0/257ms2356 KiB
18Wrong answer0/256ms2356 KiB
19Wrong answer0/356ms2200 KiB
20Wrong answer0/354ms2356 KiB
21Wrong answer0/254ms2356 KiB
22Wrong answer0/256ms2356 KiB
23Wrong answer0/257ms2360 KiB
24Wrong answer0/254ms2360 KiB