CLOSED
Can someone please explain me why this piece of code is taking around 25 secs to run, though the complexity is O(N^2log(N)) where N<=5000.
int n = 5000;
for(int i=0; i<n; i++) {
set<int> s;
for(int j=n; j>=1; j--) s.insert(j);
}
Getting TLE inserting elements in set
CLOSED
Can someone please explain me why this piece of code is taking around 25 secs to run, though the complexity is O(N^2log(N)) where N<=5000.
int n = 5000;
for(int i=0; i<n; i++) {
set<int> s;
for(int j=n; j>=1; j--) s.insert(j);
}