140302025-01-09 17:42:49zhuyiInverziócpp17Wrong answer 3/50195ms2544 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main()
{
    int n; cin >> n;
    vector <int> S(n+1);
    for(int i = 1; i <= n; i++)
    {
        int s; cin >> s;
        S[s] = i;
    }
    int maxi = 0;
    int ansl = 0; int ansr = 0;
    int cur = S[1];
    for(int i = 2; i <= n; i++)
    {
        if(S[i] > cur) cur = S[i];
        else{
            if(cur - S[i] > maxi)
            {
                ansl = cur;
                ansr = S[i];
                maxi = ansl - ansr;
            }
        }
    }
    if(maxi == 0){
        cout << -1;
        return 0;
    }
    cout << ansl << " " << ansr;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base3/50
1Wrong answer0/01ms316 KiB
2Wrong answer0/017ms564 KiB
3Accepted1/11ms316 KiB
4Wrong answer0/21ms316 KiB
5Wrong answer0/71ms316 KiB
6Wrong answer0/217ms564 KiB
7Wrong answer0/2181ms2364 KiB
8Wrong answer0/2189ms2356 KiB
9Wrong answer0/2195ms2356 KiB
10Wrong answer0/2184ms2364 KiB
11Wrong answer0/2186ms2356 KiB
12Wrong answer0/2182ms2100 KiB
13Wrong answer0/2185ms2368 KiB
14Wrong answer0/2184ms2364 KiB
15Wrong answer0/2184ms2544 KiB
16Wrong answer0/2186ms2356 KiB
17Wrong answer0/2184ms2356 KiB
18Wrong answer0/2184ms2356 KiB
19Wrong answer0/3180ms2368 KiB
20Wrong answer0/3182ms2356 KiB
21Wrong answer0/2181ms2356 KiB
22Wrong answer0/2185ms2364 KiB
23Wrong answer0/2184ms2356 KiB
24Accepted2/2180ms2540 KiB