why i getting tle??

#include<bits/stdc++.h>
using namespace std;
int main()
{
int A[1000001],n,i;
cin>>n;
for(i=0;i<n;i++)
cin>>A[i];
sort(A,A+n);
for(i=0;i<n;i++)
cout<<A[i]<<endl;
return 0;
}

you should mention the question you are trying to solve.

I think you are trying to find the max element.
You don’t need to sort the entire array. just find the max element.

 for(i=0;i<n;i++){
          cin >> k;
         if(k > max) max = k; 
    }
    print(max);

no no i slove question tutbo sort …i dont find max element

Oh, Sorry i missed the last for loop in your code.
For TurboSort Problem you should consider using Counting sort. Although C++ uses quick sort and 10^6 elements should pass the time limit but maybe the test cases are specifically made so that quick sort doesn’t pass.

I think even merge sort will work but i am not sure. Counting sort will surely pass the time limit