Tên đăng nhập Điểm ▾ Bài tập Giới thiệu
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1

include <bits/stdc++.h>

using namespace std;
int n, m, a[1000005], res, d[1000005];
int main() {
cin >> n >> m;
for ( int i = 1; i <= n; i++ ) {
cin >> a[i];
d[a[i]]++;
}
sort ( a + 1, a + 1 + n );
for ( int i = n; i >1; i-- ) {
res=res+ upper_bound ( a + 1, a + i, m - a[i] )-a-1;
}
cout<<res;
}

18401 301 1

L

18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1

Muốn tham gia để học hỏi bồi dưỡng thêm kiến thức và tìm hiểu về cách thức tổ chức thi tin học trẻ Online

18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1

~\color{#F20745}{\text{ ◖♪_♪◗}}~

~\color{#00F5FF}{\text{✪‿}}~~\color{#FF0000}{\text{haonodeptrai}{{}^{{}^{v5G✿}}}}}~

18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1

nothing

18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1

include <bits/stdc++.h>

define task ""

define for(i, a, b) for(int i = (a); i <= (b); i++)

define pii pair<int, int>

using namespace std;
int const N = 1e7+2;

int a[N];
int n,m,x,y;
pii sum[N];

int main()
{
//freopen(task".inp","r",stdin);
//freopen(task".out","w",stdout);
cin>>n>>m;
cout<<n-(m-2n)/2<<" "<<(m-2n)/2;

return 0;

}

18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1

Linh Trung - Thủ Đức

18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1

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;

}

18401
leo17112005
phanphucthinh
301 1
18401
nguyentrong17
Nguyễn Đình Minh Trọng
301 1
18401 301 1
18401 301 1

xâu con

18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1

Love algorithm.

18401 301 1
18401 301 1
18401 301 1
18401 301 1
18401 301 1