I have submitted a solution in python3 its getting 40 points and the complexity is under the constraints.
Since there is no python3/2 and pypy3/2 solutions which have got 100 points in Factor Tree can anybody confirm that python solution can get 100 points within this timelimit?
@dvyn01 can you please look into this matter?
Hey can I saw your profile. I am amazed to see how you achieved 4 by using python! Plus your chart is always positive! Can you please give some tips on how one can use python and achieve something like you?
+1
i was also wondering same
Hey even you are a python user! Can you recommend how u got so good? How you started with python and where did u learn data structures and algorithms?
I was also able to get 40 points by using PYPY3 interpreter but TLE for the same 4 subtasks in every approach. My solution : CodeChef: Practical coding for everyone
I still don’t know which part of algo is taking so much of time.
First I think you should check whether for the goal you are trying to achieve it is better to leave python
If you want to be great at cp get to those 6 7 stars may be switch to cpp as no one at that lvl cares for python so your problems will be mostly you alone, codechef and codeforces both work better with cpp (currently at least)
(It’s like getting to know js for being a web developer a lot of people don’t like it but there is no choice .)
If you are doing this for a high profile job it depends where you want to apply e.g if amazon is your goal better go to cpp/java if it’s google netflix they have don’t have much problem with python
If there is a particular career path you want and it cpp or java stick to them otherwise python work for most of others
For me i have very small interest span I initially used cpp as java was too much work and c was to much frustration so there was no choice but when i got introduced to python for a data science project i loved it how it is great to get things up and running (which works well for my current work for poc devlopment) python code i wrote was inherently cleaner and easier to read later for me there was no unnecessary things it is what you think and i also had to type less
unordered_map< , > was just {}
for(auto x: lisst) was for i in lisst
tabs worked better for me (not spaces) rather than { and }
debugging was also easy most of things just works fine when thrown in print this print(’-’*20) also helps
and so on
Once you are sure you want to use python learning path is same which is read or watch video then do question on that or start doing a question on your own for some topic and lookup online when you get stuck ( i like scnd approach )
use one of that approach and then it’s mostly until you start to like doing question or the sport or want to achieve you goal very much
For python it’s just the medium of doing question that i think changes:
I personally like leetcode (i enjoy doing questions there) with codechef long challenges when i am in mood
Leetcode is written in django and they love python , there ide is also great and leetcode also help me to look at solution gradually in steps first i see related topics than hints than ultimately solution if needed more you do questions more you will develop ability to recognize algo’s basic one at least you will understand question clearly , you wil be able to understand time complexities and your ability to google will improve you will know sites to look on internet
you can work on any other website most of non community websites like hackrrank/ earth work well with python
Since you already has 2* here i am assumming you can do easy questions of leetcode do some medium question with occasional hard and easy
60 medium 20 hard 20 easy is a good ratio than you will be ready to be in divison1
keep doing some more question some bit harder algo’s , mostly hard questions of leetcode or site of your preference you and you can reach 5* atleast and stay presistently on div1 you will be more than ready for most of interviews and will know most of cp concepts used most of time while working
All this is achieved on basis how hard and how much you study and solve i am lazy so progress for me is slow but you can achieve it much earlier
i am mostly here for p in cp , c part is does not matter much to me so all this works for me at least
If you have anything else in mind let me know i will try to help
Also learn a bit of numpy very little bit not much you can always google it helps in some question on cc also there are tricks to make python run a bit faster search them they are already on discuss somewhere some one also mentioned some high rating users who code mostly in python i don;t remember you can google that also
Hope it helps and you fell in love with the art of writing coding.
** it is based on analysis of data i collected from my own life and some senior people i know
** cpp python or any other language is not bad all of them are shit is their own ways you just have to find those whose shit ways doesn’t intersect with what you want
** anybody don’t get offended or something , just let me know once if you want me to delete the post i just don’t want to argue or reply or follow up unnecessarily
It’s good to use cpp because mostly questions are made from the point of view whether the solution will execute completely in cpp or not and other languages are given time limits according to their multiplier.
In some cases my python3 solution works and pypy3 doesn’t or vice versa and sometimes even whole logic is correct but solution works in cpp not in python so there is still some disadvantage for other languages.
If you had started recently its to go for cpp and take advantage of stl.
@dream_dev good elaborative advice given.
Thanks a lot for your advice! Will definitely see to it positively!
Just FYI, I had ditto logic in C++, same block size etc. and was still getting TLE.
40 pts
100pts : Same logic, but calculating product of prime powers below 1000 online and using Mo’s only for primes greater. This allows us atmost 1 prime factor above sqrt(Ai) for each Ai to operate on(as against max 7 earlier for <10^6), and hence drastically reduces the number of add/delete prime operations.
I will try to implement this.
But still the code complexity is under the contraints I think so.
Can you apply An alternative sorting order for Mo's algorithm - Codeforces Gilbert Order from this blog and use it in your 40 point code and try to store the gilbert order then pass it into comparator and check whether the solution passes or not.