### CuteCoder07's blog

By CuteCoder07, history, 7 years ago,

Hi, Sorry if this is newbie question, but I solved some easiest problem in codeforces, and i wonder, how can i improve my speed to solve these problem? i don't know what to do to improve my speed, should i learn some algorithms to increase my speed? Thanks.

• -1

| Write comment?
 » 7 years ago, # |   +28 just solve more and more problems.
 » 7 years ago, # |   +3 Learn to find the fact without read the whole problem statement,For example, you can read from the input part, and find what the meaning of N, M, X, etc. Once you understand the problem and got the solution, code your solution as fast as you can.N.B. I think it'll only work for problem A, or sometimes problem B. But it depends on your strength.
•  » » 7 years ago, # ^ |   0 I do agree with this. But keep in mind to consider tricky cases if you choose not to read the whole question
•  » » 4 years ago, # ^ |   0 I think this is a wrong way.Many important information will be missed.
•  » » » 4 years ago, # ^ |   0 I agree this is totally not the way specially if you're new. You'll end up missing a lot of info and just getting more stressful and anxious. What you need to improve is coding skills and not reading skills..... Coding can be improved by solving more and more problems.Get a stopwatch and record how long do you take to solve a problem A from the first read till AC and aim for getting it in less then 10 minutes. If you manage to do it, that's already great and it's time to move on to Div2 B and C.
•  » » » 4 years ago, # ^ |   0 Ugh I just realized this blog is 3 years old...... why the fuck do people bump these :/
•  » » » » 4 years ago, # ^ |   0 LMAO its okay i'll upvote you
 » 7 years ago, # |   0 If you are trying to solve div 2 A problems the algorithms provided in and STL containers should be sufficient. However once you start solving div 2 B or div 1 A you will need some additional algorithms for working with graphs certain problems as well as others for other situations.
•  » » 7 years ago, # ^ | ← Rev. 2 →   0 Do you know where to learn graph? I'm looking for website with simple implement about algorithms like graph, dp, etc.
•  » » » 7 years ago, # ^ |   0 I am not sure about websites this is the standard books on algorithms https://en.wikipedia.org/wiki/Introduction_to_Algorithms I learnt most of my graph theory and dp stuff from it. Also this guy http://mirror.codeforces.com/blog/pllk just released a free book on competitive programming which is really good.
•  » » » 7 years ago, # ^ |   0 If you are lazy you can find ready-to-use implementations (java only) from algs4.cs.princeton.edu (Algorithms by Sedgewick and Wayne). They are much faster than built-in java things, for example PriorityQueue. There are many useful things like graphs, MST, network flow, etc. that are also implemented. If it doesn't exist there, just translate the pseudocode from wikipedia.
•  » » » » 7 years ago, # ^ |   0 They are much faster than built-in java thingsJust curious, how did you know? Is there any bench test done or is it base on experience?
•  » » » » » 7 years ago, # ^ |   0 Well, it seems like they have a lot less corner case handling and etc. I haven't really looked at the code that much. But here is a case where the built in priority queue fails:http://mirror.codeforces.com/blog/entry/47908
•  » » » » 7 years ago, # ^ |   0 But i'm not use java, is that possible to implement it to c++?
•  » » » » » 7 years ago, # ^ |   0 or you can just translate it yourself, it is not hard.
 » 7 years ago, # | ← Rev. 2 →   +10 Some tricks: test crawler : parse sample test cases from web page. No copy'n'paste any more. test script : diff your output with expected output turn on more compiler warnings useful shorthands in your template a standard code library: it can be included like standard library without copy'n'pate. start coding only after you have clear idea. Otherwise you will waste time to change your code frequently and debug.
•  » » 7 years ago, # ^ |   0 How can you include personal code library without copy paste?
•  » » » 7 years ago, # ^ |   0 combine all included files in my library by a script. also copy it to clipboard, or submit it directly.
•  » » 7 years ago, # ^ |   0 Advises 3 and 6 are very reasonable, but I don't think any of those will increase your skills in the long run. If you want to be better, just solve many problems.
•  » » » 7 years ago, # ^ | ← Rev. 2 →   0 Sure. These are just some competitive programming tricks.But when I stop wasting time in these useless labour (copy test cases / diff by eye / debug / write the same code again and again), I can solve more problems :)
•  » » » 4 years ago, # ^ |   0 I am now able to solve problems up to div2 D level 1800-1900 rated but i m very slow can you plz suggest what should i do currently i used to solve Div2 D daily like 10-12 problem daily of codeforces should i continue this or should i jump to other websites like atcoder,topcoder,codechef i m familiar with codechef, i found topcoder's environment too complicated for my stupid ass, and i didn't tried atcoder yet!!! THANX IN ADVANCED LIKE IF YOU EVER REPLY TO MY COMMENT!!1 THANK YOU!!! Errichto can you also plz make a video for someone like me i found ur videos quite good!!!
 » 7 years ago, # |   +5 also never ever use pow function in c ++
•  » » 7 years ago, # ^ |   0 can you explain why?
•  » » » 7 years ago, # ^ |   0 In most languages, powreturns a double. This can lead to silly precision issues where pow(10,2) = 99.