Thank you

very helpful, Thanks

Is it only me or comment UI is not intuitive.

Thank you

HELP NEDEED

it’s really nice tips, thanks.

very good suggestion for new users

Thanks

Thank you

nice

**Testing Testing**

Thank you it is very helpful for me.

hiii bro you can print this pattern this question asked in zoho company

1 12 11 10 9

2 13 15 8

3 14 7

4 6

5

this pattern is right side

Thank You

Admin should ideally be tagged for CodeChef related things, like feedback on the website, feature requests, suspected wrong test cases in a problem, etc.

thank you

#
Problem Code: **ADJSRT**

#include<bits/stdc++.h>

#define ll long long

using namespace std;

int n;

vectorv;

ll num;

int merge(int l,int r,vector<pair<ll,ll>>&a,int mid)

{

int inv=0;

int l_sz=mid-l+1;

int r_sz=r-mid;

vector<pair<ll,ll>>L(l_sz+1);

vector<pair<ll,ll>>R(r_sz+1);

for(int i=0;i<l_sz;i++)

{

L[i].first=a[i+l].first;

L[i].second=a[i+l].second;

}

for(int i=0;i<r_sz;i++)

{

R[i].first=a[mid+1+i].first;

R[i].second=a[mid+1+i].second;

}

L[l_sz].first=LONG_MAX;

R[r_sz].first=LONG_MAX;

L[l_sz].second=-1;

R[r_sz].second=-1;

int r_i=0;

int l_i=0;

for(int i=l;i<=r;i++)

{

```
if(L[l_i].first<=R[r_i].first)
{
a[i].first=L[l_i].first;
L[l_i].second=i;
l_i++;
}
else
{
a[i].first=R[r_i].first;
r_i++;
for(int i=l_sz-1;i>=l_i;i--)
{
v.push_back(L[i].second);
L[i].second++;
}
}
```

}

return inv;

}

int mergesort(int l,int r,vector<pair<ll,ll>>&a)

{

int inv=0;

if(l<r)

{

int mid=(l+r)/2;

inv+=mergesort(l,mid,a);

inv+=mergesort(mid+1,r,a);

inv+=merge(l,r,a,mid);

}

return inv;

}

int main()

{

cin>>n;

ll x;

vector<pair<ll,ll>>a(n);

int inv;

for(int i=0;i<n;i++)

{

cin>>x;

a[i]={x,i};

}

inv=mergesort(0,n-1,a);

cout<<v.size()<<endl;

for(int i=0;i<v.size();i++)

cout<<v[i]<<" ";

return 0;

}

can you please reduce the time complexity of this code?