80142024-01-12 10:21:19DhaneHaneVölgy (100 pont)cpp17Wrong answer 30/10041ms9284 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,p1,p2; cin>>n;
    vector <int> x; x.resize(n+1);
    int maxi1=-1;
    for (int i=1;i<=n;++i){
            cin>>x[i];
            if (maxi1<x[i])
            {
                maxi1=x[i];
                p1=i;
            }
    }
    int maxi2=-1;
    for (int i=1;i<=n;++i)
    {
        if (maxi2<x[i] && p1!=i && i+1!=p1 && i-1!=p1)
        {
            maxi2=x[i];
            p2=i;
        }
    }
    cout<<max(p1,p2)-min(p1,p2);
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base30/100
1Accepted0/03ms1808 KiB
2Accepted0/03ms2016 KiB
3Accepted5/53ms2396 KiB
4Accepted5/53ms2536 KiB
5Accepted5/52ms2524 KiB
6Accepted5/53ms2508 KiB
7Wrong answer0/53ms2764 KiB
8Wrong answer0/53ms2928 KiB
9Wrong answer0/53ms2868 KiB
10Wrong answer0/53ms3012 KiB
11Wrong answer0/54ms3048 KiB
12Wrong answer0/54ms3360 KiB
13Wrong answer0/56ms3344 KiB
14Wrong answer0/56ms3668 KiB
15Wrong answer0/532ms4820 KiB
16Wrong answer0/537ms5328 KiB
17Wrong answer0/537ms5796 KiB
18Accepted5/537ms6388 KiB
19Accepted5/537ms7208 KiB
20Wrong answer0/541ms7920 KiB
21Wrong answer0/541ms8604 KiB
22Wrong answer0/541ms9284 KiB