140282025-01-09 17:40:22zhuyiInverziócpp17Wrong answer 3/50192ms2548 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 = 1;
    for(int i = 1; i <= n; i++)
    {
        if(S[i] > S[cur]) cur = i;
        else{
            if(S[cur] - S[i] > maxi)
            {
                ansl = S[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/017ms572 KiB
3Accepted1/11ms316 KiB
4Wrong answer0/21ms316 KiB
5Wrong answer0/71ms556 KiB
6Wrong answer0/217ms564 KiB
7Wrong answer0/2182ms2364 KiB
8Wrong answer0/2187ms2356 KiB
9Wrong answer0/2192ms2368 KiB
10Wrong answer0/2186ms2356 KiB
11Wrong answer0/2186ms2356 KiB
12Wrong answer0/2184ms2324 KiB
13Wrong answer0/2186ms2360 KiB
14Wrong answer0/2184ms2356 KiB
15Wrong answer0/2182ms2548 KiB
16Wrong answer0/2187ms2368 KiB
17Wrong answer0/2187ms2356 KiB
18Wrong answer0/2185ms2356 KiB
19Wrong answer0/3181ms2360 KiB
20Wrong answer0/3180ms2364 KiB
21Wrong answer0/2181ms2356 KiB
22Wrong answer0/2184ms2360 KiB
23Wrong answer0/2184ms2548 KiB
24Accepted2/2180ms2356 KiB