yeeeeeeee

yang_zhiyu 2023-10-21 10:38:19

int tmp[n];
    int i=l,j=mid+1;
    int k=0;
    while(i<=mid && j<=r){
        if(a[i]<=a[j])  tmp[k++] = a[i++];
        else  tmp[k++] = a[j++];
    }
    while(i<=mid)  tmp[k++] = a[i++];
    while(j<=r)   tmp[k++] = a[j++];
    
    
    for(int i=l,j=0;i<=r;i++,j++) a[i]=tmp[j];