Hello This is Mehtab Butt from Pakistan I really need the help of the code forces community because I am new at this platform and on the submission of my Nezzar and Symmetric Array, the problem I am getting the error Idleness limit exceeded. I am coding in c#. I did not find any satisfactory solution on google as well.
Link to my code: https://codeforces.me/contest/1478/submission/106223889








Your
GetInput()method can't properly parse lines consisting of multiple integers. It just skips them and will wait for more input.Also, don't write your own
sort, at least if it is insertion/bubble/selection sort. It will TLE if the input is longer than $$$10^4$$$. Also also, rwad some style guide for C#. Method names usually start with capital letters and don't contain underscores.Thanks a lot for your quick response. That was really helpful. But now I am getting TIME_LIMIT_EXCEEDED error although I have reduced my code and used merge sort instead. https://codeforces.me/contest/1478/submission/106289761
These lines seem to be one cause:
if(!d[i].Contains(num)) d[i].Add(num);.d[i].Contains(num)iterates over all elements ofd[i]to check if any of them isnum. That means its complexity is $$$O(n)$$$. You do this for every element of the array, making the complexity $$$O(n^2)$$$. $$$n$$$ here can be $$$10^5$$$, which makes this too slow.If the goal is to make the array consist of only unique elements, there is a built-in method in C# for it that "should be close to" $$$O(n)$$$ complexity.