Tên đăng nhập Điểm ▾ Bài tập Giới thiệu
2641 19576 29
2642
thuphung18122005
PHUNG VAN THU
19506 48

include<bits/stdc++.h>

using namespace std;
long n;
long long a[1000001];
int main(){

cin>>n;
long long x,y,j1,j2,res;
for(int i=0;i<n;i++)
    cin>>a[i];
    x=*max_element(a,a+n);
    y=*min_element(a,a+n);
  j1=1e9;
  j2=-1e9;
  res=1e9;
  for(int i=0;i<n;i++){
    if(a[i]==x)j1=i;
    if(a[i]==y)j2=i;
    res=min(res,abs(j1-j2)+1);

  }
  cout<<res;

}

2643 19566 269
2644
Baoduy2011 711
DUY
19559 121

KO CO GI

2645 19553 366
2646 19550 106
2647
nhật
Trịnh Nguyễn Nhật Vinh
19543 352

i'm back

2648
rickmore
Ngô Ngọc Châu Thành
19526 133
2649 19503 76
2650
EchoFE2
Lê Hoàng Bách
19533 77

Overall:


Coyote inside, human outside

Other profiles of me:

⚠️WARNING: HAS (potentially) NSFW SOCIAL ACCOUNTS⚠️
EchoFE2's Codeforces Profile
EchoFE2's VNOJ Profile
Discord Username: echofe2
Roblox: EchoFE2 (@13999A)