highonjuice's blog

By highonjuice, history, 2 months ago,

Practice makes perfect, and cyan feels better than green. (Skip to the end if you don't wanna hear an interesting story)

A while ago, I made a post about almost being specialist. After a month of getting stuck on pupil, I was starting to think I was not fit to advance in my competitive programming journey. Doubts fell like droplets on a rainy day...

But I still practiced... Day after day I would do my daily dose of problems, learning cool new algorithms along the way. Maybe DSU? BFS? DP? Probabilities? Every day I was equipping my toolbelt for the journey. Every day I would challenge myself to a slightly harder task. Although I had to admit, in the back of my head, I was wondering when I will ever use these Data Structures and Algorithms.

Then the day came. In today's contest (Round #736 Div1+Div2), I briskly solved A (as I usually do) and took my time on B. (it was implementation, so it was a little annoying). Then I met C.

C was an interesting graph problem. I was thinking, dfs and brute force, but I saw that N was up to 1e5 so it wasn't possible. Then I found some crucial observations. I realized every update only changes the answer by 1. Then I found that I could make the problem a directed graph. More observations followed. Soon, I simplified from an O(n^2) algorithm that involved simulation to an easy greedy O(n) solution. Oh man. I loved it.

Then I found D, D was interesting. A twist from problem A. After a bit of doodling and writing testcases, I found myself using RMQs (or sparse tables). I barely cared for RMQs, and thought I would never need them, but the algorithm needed an O(1) GCD query, so maybe just maybe it was right. And it was.

After the contest I realized I was top 700, I was so happy. It was worth it in the end. Challenge yourself, and high ratings will come.

If you are stuck in pupil or newbie, the most common reason is you aren't challenging yourself. Do harder problems and most of all, have fun with it. It's going to be a long ride, so might as well enjoy it.

If you are better than me and have a higher rating, I hope you smiled at this blog post, and watch out, because I may even pass you soon.

As always, Happy Coding!!

Also my tags aren't going to be bad, I'll just put #contest or something generic, so it's not instagram-like

• +245

 » 2 months ago, # |   0 May I ask which problem you recommend to do? 1700, 1800? or maybe 2000 up?
•  » » 2 months ago, # ^ |   0 Do problems 100-300 points above your level. You are 1270, so maybe do problems from 1300-1600 problems. Maybe 1700 for fun.
•  » » » 2 months ago, # ^ |   0 Understand Thanks!
 » 2 months ago, # |   +2 Congrats
 » 2 months ago, # |   +17 Congratulate!Challenging yourself is the correct attitude to Compitive Programing, but it was hard to insist. Weeks ago, I was an Candidate Master, but I back to Expert now, I think I should challenging myself more, and practice more, just like you.Happy Coding! Hope both of us can insist challenging ourselves and be more powerful in CP!
•  » » 2 months ago, # ^ |   0 thanks man, gl on becoming CM again in the future
 » 2 months ago, # |   0 Congrats Brother! This posts motivates beginners like us :)
 » 2 months ago, # |   0 Any tips for beginners?
•  » » 2 months ago, # ^ | ← Rev. 2 →   0 CF VisualizerFor you specifically, do more problems around the 1000-1300 level, those are typical B problems. If you can do those, you will be fine. If you don't understand the solution, read the editorial and try to understand how you can improve next time. Look up some youtube videos if you don't understand.
•  » » » 2 months ago, # ^ |   0 thanks buddy! I will follow the same path
 » 2 months ago, # |   +1 Congratulations!
 » 2 months ago, # |   0 This is so inspiring!
 » 2 months ago, # |   0 Hey congrats Highonjuice on becoming cyan,can u give tips/guide by looking at my profile how to improve further more.
•  » » 2 months ago, # ^ | ← Rev. 2 →   0 You did great on today's contest, so I'd suggest learning new data structs and algos, and practice, practice, practice. Also utilize different websites like atcoder and SPOJ for more variety. One more tip...practice on your speed, problem B took a while for you during R #736, so practice on speed as well. (Atcoder is a great place to start)I've actually never done a contest on Atcoder because I have to wake up at 7 am in my time zone, but maybe I'll do one soon.you will definitely be pupil real soon, too bad the next contest is a full week away
 » 2 months ago, # |   0 Congratulation. Consistency and hard work are the keys. You are inspired me a lot.
 » 2 months ago, # |   0 May I ask you if would you recommend me to do questions of 1800 1900 2000 ratings and how did you practice for advanced data structures of range queries?
•  » » 2 months ago, # ^ | ← Rev. 2 →   0 I think 1800 and above is incredibly hard. I think being only 300 above your current rating should be good enough. Many times, I would not be able to solve 1500 problems even though I've been practicing 1800 and above. Also, I practiced RMQs and other algos and data structs through https://cp-algorithms.com/. It's a great website and lists some cool algos to learn. I try to just pick out random ones and read the articles for fun. If I don't understand it. I guarantee there is a great video online from cool youtubers like SecondThread, galen_colin, Errichto and Geothermal who can explain this stuff 10x better than me. You aren't going to get these algos in every contest, but learn them because one day, you will encounter them. (tools in a toolbelt)
•  » » » 2 months ago, # ^ | ← Rev. 4 →   0 Thank you for your comment and sharing your views.. hopefully you will reach new heights in coming months
 » 2 months ago, # |   0 Also my tags aren't going to be bad, I'll just put #contest or something generic, so it's not instagram-like I'm really glad to see that you took my comment so well (and really surprised that you even remember it at all). Congratulations on reaching specialist, and good luck to you!
•  » » 2 months ago, # ^ |   +7 lmao, I actually thought it was true, my post really did seem to belong on Instagram lol. It was pretty funny, and it's just a memorable joke.
 » 2 months ago, # | ← Rev. 2 →   0 [deleted]
 » 2 months ago, # |   0 Any Suggestion for me, I'm stuck at Newbie.
•  » » 2 months ago, # ^ | ← Rev. 2 →   +1 3 things: Never give up, a lot of the times I was like "this problem is out of my level," but sometimes you may be surprised Make observations and talk it out. Solving a problem is all about finding key observations and using different algos to solve it. try learning a new algorithm every day. The more you learn the more tools you have in your toolbelt. (the higher chance you can solve a problem) I think u can easily break out, but you just gotta get out of ur comfort zone. I believe in you ;)
•  » » » 2 months ago, # ^ |   0 Hey I do agree learning new algos adds to our toolbelt...but sometimes i feel for problems rated 1300-1500(which I am focusing on now) don't require knowing many algorithms or DS..they are just a matter of practice but learning new algos can definitely help me solve higher rated problems...so I am confused if I should first be strong at a particular rating or spend more time learning new stuff
 » 2 months ago, # |   0 Can you tell me why am I still a newbie even after solving 3 problems from div2 codeforces round(123 rating increase)
•  » » 2 months ago, # ^ |   0 First of all, gj. Solving C was pretty tricky for me, and some of my specialist friends couldn't solve it.However you were slow. Speed is really important. If I solved my problems much faster, I would be top 50. Here's the deal, you took 26 min on problem A, and 1 hour and 4 min on B, and 2 hours and 15 on C. Not only will you have more time to solve later problems, but being faster also feels good too. Don't worry, practice will just speed you up anyways. Also, make a template, add some common functions like binary search or something, they can speed up the process by a bit. (find youtube videos if you don't know where to start)
•  » » 2 months ago, # ^ |   0 tbh you will reach pupil soon if you keep solving problems like C continously.
•  » » » 2 months ago, # ^ |   0 Thank you so much for such detailed explanation .. actually this is just my beginning, I registered early but did nothing for 6 months .I think this was just luck that I was able to solve C cause it was just implementation requiring no great concepts .Though with time I hope I'll become worthy enough.
 » 2 months ago, # |   +6 Congrats bro ! hope to see you in better and higher rating :)
 » 2 months ago, # |   +3 Hello! I have only recently started Competitive Programming seriously. I saw you say that it is important to solve problems beyond your difficulty. I have two questions. How does one improve speed and accuracy? As we know most Div 2A, B and C are very easy but people still take time and get WAs. Wouldn't it make sense to practice 'some' easier problems of your level and try and ace them as fast/accurately as possible? When solving tougher problems, it is very likely that you may not be able to solve them, and thus will end up looking at the hints/solution approach/code. If I do that, does that still count as a solve? Because technically, I didn't solve it. Also how long until I actually look at the solution?
•  » » 2 months ago, # ^ |   +8 Sure, you can solve easier problems for fun (I do too), but speed and accuracy for easier problems comes naturally with getting better at solving harder problems. Whether you "solved" it or not is a matter of semantics, but still implement it for practice. How long until you look at the solution depends, but at your level, the recommendation is that you should start looking at the solution after 20-30 minutes of being stuck (i.e. out of ideas).
•  » » » 2 months ago, # ^ |   0 Thanks a lot! What level of problems would you suggest I should be doing right now? I have only given two contests but I was able to solve Div2 A, B, C of the previous one.
•  » » » » 2 months ago, # ^ |   0 Your performance in your last contest was ~1400, so I would initially recommend to try problems rated 1400-1700. Note that your performance in one contest can vary, so if you find them too easy/too hard, adjust accordingly.
•  » » » » » 2 months ago, # ^ |   0 Oh cool. Thanks!
 » 2 months ago, # |   +34 today was the day I got higher rating than majk
•  » » 2 months ago, # ^ |   +17 I should organise a round to fix that.
•  » » » 2 months ago, # ^ |   +13 plot twist: I sleep through it again
 » 2 months ago, # |   0 What was your thought process for D, did you end up solving primarily by writing some testcases down or did you do some mathematical manipulations with the modulo formulas?
•  » » 2 months ago, # ^ |   0 I noticed at first that if I subtract the minimum from every number, I could check through GCD whether they could have the same modulo (if they had a gcd>1 that means they have a factor that could lead to the original number with the correct mod). I followed and constructed an RMQ (Gcd) and performed a binary search to find the answer. Wrong answer. Then I asked, "what if I take the differences of adjacent numbers?" And it worked.I write more test cases than formulas. Although I think formulas make your solution more concrete, test cases are usually faster for me. I dunno, either one is good.For more details to the solution, check this video by MagentaCobra. He's great at explaining stuff and I like his vids. https://www.youtube.com/watch?v=nD7Y7v1iWJ8
•  » » » 2 months ago, # ^ |   0 highonjuice orz
 » 2 months ago, # | ← Rev. 2 →   +2 high ratings will come
•  » » 2 months ago, # ^ |   +4 Very appropriate profile picture for your current situation, I hope you rise soon to purple.
•  » » » 2 months ago, # ^ |   0 thank you)
•  » » 2 months ago, # ^ |   +1 you still can return back, i hope :D goodluck
 » 2 months ago, # |   0 Good going keep it up... something similar happens to me too :)
 » 2 months ago, # |   +1 Wholesome Post <3
 » 2 months ago, # |   0 Should i need to learn advance data structure (like segment tree) or just solve problems above my rating .
•  » » 2 months ago, # ^ |   0 Same Questions :_:
•  » » 2 months ago, # ^ |   0 Doing both is always better than doing one thing, but keep this in mind that data structure/advance technique related problems normally come up in later problems of Div2, primarily, D, E, F. For A, B, C, you just need to make the right observation and that is it, so if you struggle with A, B, C, learning advanced DS may not be in your best interest, but I guess you can overkill certain "easy" problems using one.
•  » » 2 months ago, # ^ |   0 I agree with Bungmint, learn and do harder problems at the same time.
 » 2 months ago, # |   0 "It's going to be a long ride" This statement hit me hard. Thanks for motivating me and others !!!
 » 2 months ago, # |   0 Oh man, your consistency and rating after the contest look good. I mean it seems so satisfying connected with that doubts in the post.
 » 2 months ago, # |   0 I think you meant Cyan not Blue!
•  » » 2 months ago, # ^ |   0 lmao very true, I'll change the blog post
 » 2 months ago, # |   0 Auto comment: topic has been updated by highonjuice (previous revision, new revision, compare).
 » 2 months ago, # | ← Rev. 2 →   0 Pls suggest me too:- I started but coz of pandemic I had some hard time now I am back to almost from where I begin. Any remarks are welcomed!! orz
 » 2 months ago, # |   0 Is there are O(1) GCD query in cp-algorithms ?
•  » » 2 months ago, # ^ |   0 No, but there is the RMQ page.And in the case of problem B , we could modify the structure shown there because the functions (GCD and MIN) work similarly, i.e Min(a,Min(a,b)) = Min(a,b) | GCD(a,GCD(a,b)) (and that allows you to merge overlapping segments to solve in O(1), something that couldnt be done with operations such as addition, multiplication, etc.)
•  » » » 6 weeks ago, # ^ |   0 Thank you
•  » » 2 months ago, # ^ |   0 Check out Sparse Tables on the site
 » 2 months ago, # |   0 Congrats!
 » 6 weeks ago, # |   0 ORZZZ!!! Congratulations
 » 3 weeks ago, # |   0 highonjuice, who am I to judge, but don't you think it was a little too early to write an inspirational blog and give advices in the comments?
•  » » 3 weeks ago, # ^ |   0 +1, he dropped to pupil again, I think you really should write a blog when you became Expert
•  » » 3 weeks ago, # ^ |   +1 You said, who am I to judge, and then you judged. ;;
•  » » 2 weeks ago, # ^ | ← Rev. 9 →   +3 lmao, I was just really happy when I became specialist. I'll keep making blogs because I think it's fun. it's ur choice to read then. I made a leap of faith towards specialist, and although I'm not cyan rn, I'm sure I can make it back soon.
•  » » » 2 weeks ago, # ^ |   +3 I was just really happy when I became specialist... I'm sure I can make it back soon When you do, please write another blog. Codeforces needs every documentation of that asap.
 » 3 weeks ago, # |   0 please tell me what should I do?