Cafune's blog

By Cafune, history, 5 weeks ago, In English

Hello CodeForces!

This is my first time writing a blog post so please hang on with me c:

I'm currently a student in US studying Computer Science/Engineering. I never focused much on programming like my fellow peers in the Uni I go to (some of them apparently did USACO or some form of olympiad), and I have this feeling that I'm falling back behind regardless of how hard I try in school. # Note that I do have some mathematics background, qualifying for AIME with a score of 9 (which isn't that amazing, but still something).

However, that feeling of falling behind is the reason I started doing CodeForces again (did a few competitions freshman yr), with a sole objective to become a better coder.

The problem is:

I'm able to solve first two problems in D2, but cannot seem to find solutions for the next few problems. However, the topics in C and D in D2 problem sets are topics that I'm relatively familiar with, but only after I read the editorial I understand how to apply these concepts to create an algorithm. I'm also having exceptional trouble with edge cases.

My current goal is to reach approximately 1500 by end of this year (maybe 1900 hehe). Is this too ambitious? And if so, how would you insanely smart people in Codeforces would approach this case where ur just simply not good enough to solve a problem?

Thanks for reading my rant and I would really appreciate it if y'all can give me some good insights and tips on what should I do to progress my journey of becoming a semi-proficient coder.

POST ROUND 997: CHAT I SOLVED 3 PROBLEMS OMG POST ROUND 998: Making the goal 1900. I think I just did the best coding session (including interviews) in my life

  • Vote: I like it
  • -8
  • Vote: I do not like it

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

I think the best advice for you right now is that you just need to solve more problems . The more you solve the better as it boosts your confidence as well as helps you experience different approaches.

1500 is surely achievable for you I believe and maybe you could go for more .

Best of luck.

  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Thanks!

    I've been mostly doing LeetCode problems. Would changing my focus into CF problems a better alternative?

    • »
      »
      »
      5 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      yes

    • »
      »
      »
      5 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Yes I think. Just keep on doing problems a bit above you rating until you are comfortable which is usually around 30(for me). Do not try to learn advanced data structures or techniques in the beginning , I reached specialist without knowing graphs , trees or dp. Applying what you already know is enough for cyan i guess.

      P.S. : Learn Binary Search thoroughly

    • »
      »
      »
      5 weeks ago, # ^ |
        Vote: I like it -8 Vote: I do not like it

      For sure. Leetcode is way easier than cf. Only with Uni third semester knowledge (Algorithms and Data Structure I and Discrete mathematics) I can solve a lot of problems easily on leetcode, but not the same here on CF. I think leetcode (in my opinion and considering the problems that I solved) is more data structures oriented, not focusing so much in math. If you know the data structure that you need to use in the problem, you can, usually, easily solve it. Here on CF is a little bit different, you usually need to have a good insight, prove that it is correct, plus knowledge of the topics, usually involving math concepts, to solve the problem.

      I'm still a newbie, so I can be wrong. But I've been using both websites for some time and those are the differences that I've found until now.

  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    What about me?

    • »
      »
      »
      5 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I think you have enough knowledge to be around 1300ish. I would suggest you to re-evaluate your solution before submitting, check for all the edge cases you can think of and try to think of a counter case where your solution might not work. Do this for 5 minutes I guess so that there is no silly mistake in your code or any other issues which u can find out since the penalty for wa is 10 minutes so this is still better in lower elo as it is usually speed that determines your rank.

      Hope you get green soon.

      • »
        »
        »
        »
        5 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        what about me

        • »
          »
          »
          »
          »
          5 weeks ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          How do you solve questions when practicing? I mean what is your appraoch?

          • »
            »
            »
            »
            »
            »
            5 weeks ago, # ^ |
            Rev. 2   Vote: I like it 0 Vote: I do not like it

            And which rating problems i should grind right now 1100-1300 or 1200-1400 or 1300-1400

            • »
              »
              »
              »
              »
              »
              »
              5 weeks ago, # ^ |
                Vote: I like it 0 Vote: I do not like it

              Do the ones which require you to think a bit , Like maybe you get very close to the answer but are not able to solve it or it takes like 30 mins plus to solve. Do those till you get comfortable with that range then move up.

              I use the new add random problems feature in gym to generate random problems in a certain difficulty and solve them , try to do recent problems like post 2022.

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Well you could try practicing different OJ like A2OJ(however its a little old). You might have a look at TLE31 sheet . It engages a lot of topics and gives a huge understanding and it will definitely help in developing the approach newcomers often lack.

However the last step is consistency.

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

I think if you know the topics then solving problem should not be that big of issue, you just need to be able to use your experience of past questions you did and a little bit of being intuition and it's done. I was kinda on break since last 2 months.... i gave contest today after long... it was kind of hard to understand stuff in the beginning of contest but with time things started going well... And 1500 or 1900, it's surely not too far if you start enjoying the problems. (p.s.: Maybe i should get to 1900 too :p ...)

  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Im a newbie, actually I try to code so hard but after 6 months, I begin think my knowlegth is small. Now I know a graph, STL, basic knowlegth,.. but I cant AC the third problem in any Div2, what should I do?

    • »
      »
      »
      5 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      For third question, mostly I think around the topics like bitwise, two pointer, prefix sum and binary search and mostly that's enough.... and sometimes they ask pattern question which are mostly solvable if you have seen problem like that before.... I guess solving 20-30 1400-1600 rated questions would easily give you idea about how to approach them

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Cafune (previous revision, new revision, compare).

»
5 weeks ago, # |
  Vote: I like it +5 Vote: I do not like it

I learned most of the topics relevant to USACO Platinum in high school, and yet I still can rarely solve any of the recent plat problems.

Topic knowledge is necessary but far from sufficient, you need to have these problem-solving structures in your brain and the only way to improve problem-solving is to solve more problems.

Colin Galen made a video where he talks about the problem-solving process in-depth and he floated an alternative to solving problems aimed at solely building the intuitive pattern recognition you often need to solve harder problems. I would watch his videos.

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

If you can do well in the math competitions, codeforces shouldn't be that hard to get good at. That is because math is more g-loaded than codeforces. I'd say that math competitions have a g-loading of $$$.55-.6$$$ and codeforces has a g-loading of $$$.45-.5$$$ or so. Div. 1 is probably more g-loaded than div. 2, but it is really hard to say, as div. 2 participants don't have as much experience, on average. But if we gave these problems to the general population, div. 1 would definitely be more g-loaded.

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Congrats on green.

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

I used to do some *1900~*2200, but still often failed *1400 greedy/constructive/ad-hoc problem in contest. I started doing AtCoder four months ago, and I think I gain rating because of this, so maybe switch to it helps when stuck, at least it works for me.

  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    like which problems u solved in atcoder as I am also failing on 1200-1300 adhocs even though I am practicing 1600s-1700s right now

    • »
      »
      »
      5 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Mainly easy ARC problems and ABC blue ~ low-orange problems. I try to figure out problems on my own, but I would read the editorial after thinking too long without progress.

      • »
        »
        »
        »
        5 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        I am also kinda trying doing abc E's right now and doing abc virtual for speedforce practice

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Attending in person training-camps help me get unstuck. Usually when I feel that I cannot learn a certain topics/reach a certain goal. The motivation gained from working with highly motivated people helps a lot, and the explanations from the coaches help a lot too.

»
5 weeks ago, # |
  Vote: I like it +22 Vote: I do not like it

Hello! It looks like you're Korean! I have a post I wrote a while ago about the mindset for excelling in competitive programming (CP). I'm sharing it with you :) Fighting!

Intuition and Insight

This post aims to thoroughly describe my personal approach to problem solving.

Problem Solving (PS) is the study of resolving problems. In Korea, the most common PS problems encountered are those from the College Scholastic Ability Test (Suneung) mathematics. Therefore, I will relate various thoughts on PS to Suneung math.

One of the frequently covered topics in Suneung math is 'intuition' and 'insight.' Often, when people who are good at math solve a problem, they might say something like, “This problem required a lot of insight.” However, the term "insightful" is quite vague. What makes a problem insightful?

Let's continue the conversation with a simple example. Suppose we have the inequality |x — 5| > 3. How would you solve this problem?

Most people will think of one of two methods:

  1. Graphical Method: Plot x — 5, then reflect it across the x-axis to graph |x — 5|, draw the horizontal line y = 3, and visually determine the solution range.

  2. Piecewise Method: Break down |x — 5| into a conditional function (x — 5 when x — 5 ≥ 0, and 5 — x when x — 5 < 0), solve the inequality for each range separately, and combine the results.

Great. How did you come up with your solution? If you have studied math sufficiently, most of you would have come up with a solution effortlessly. Why is that?

People who are good at solving math problems often intuitively know how to approach a problem as soon as they see it. This is because their extensive problem-solving experience and knowledge have been subconsciously internalized. Especially when dealing with concepts that require insight, such as absolute value functions, this intuition becomes more pronounced.

The absolute value function itself cannot do much on its own. For example, solving an inequality like x² > 3 is straightforward by taking the square root of both sides, but solving |x — 5| > 3 is not as simple. This is because the absolute value function is defined conditionally based on the value of x. It returns '5 — x' when x is less than 5 and 'x — 5' when x is greater than or equal to 5.

Therefore, to solve an absolute value inequality, you need to consider it conditionally. This idea is called 'insight,' and while it must be consciously thought of at first, with much practice, it becomes internalized and can be applied subconsciously. This is what we call 'intuition.'

Looking back to when we first learned absolute value functions in middle school, no one would have thought to break them down into conditional functions. However, through understanding and thinking about absolute value functions, we develop this insight.

When you have well-established insights like this, seeing an absolute value expression immediately triggers the thought, “Ah, this is how I should solve it.” This is referred to as intuition.

People who are good at problem solving have well-established intuition. Problems can indeed be very large, but locally established intuitions, like the one for absolute values, serve as excellent tools for problem solving. As these intuitions accumulate, they make approaching problems easier. It is no exaggeration to say that this determines the ability to generate insights.

Developing Insight

So, how can we develop the ability to generate insights? In solving math problems, especially in Suneung math, the concept of 'assigning inevitability' is often emphasized. This means consciously organizing parts of the problem-solving process that you might not have initially thought of and understanding why you need to solve it that way.

For example, when solving the absolute value inequality |x — 5| > 3, we divide the problem into cases where x is greater than or equal to 5 and where x is less than 5. Here, 'assigning inevitability' involves questioning and organizing why we need to divide and solve the problem in this manner.

In other words, you need to realize, "Because the absolute value function is expressed differently depending on the value of x, we need to solve the problem by dividing it into cases." Through this process of assigning inevitability, you can recall and apply the relevant concepts when encountering similar problems.

This assigning inevitability goes beyond simply finding the correct answer; it helps deepen your understanding of the problem-solving process. This enhances your problem-solving abilities and develops the cognitive skills necessary to apply them to new types of problems.

Therefore, to achieve good results in Suneung math and, more broadly, in the entire PS domain, actively utilizing 'assigning inevitability' is essential. While solving problems, you need to review your solution process and make an effort to understand why you solved it that way. Through this, you can internalize the concepts and ideas necessary for problem solving.

I believe that when studying PS, it is important to approach it in this manner.

Upsolving is similarly important for similar reasons. It is the process of enhancing your abilities by solving problems that you previously couldn’t solve, ultimately enabling you to tackle them successfully.

  • »
    »
    5 weeks ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    Thanks for the thoughtful feedback!

    Personally, I never took Suneung (I know it's not even comparable with SAT which I took)

    But your feedbacks really helped in Round 998 that I just took, and I was able to use various different approaches instead of being fixated into one. It seems like I know what the concepts are, but never know how to apply it well.

    Gotta treat you to some Korean Fried Chicken for this :3

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Cafune (previous revision, new revision, compare).

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Not gonna lie, rather than asking for tips, you should give tips XD.

Nice div(1+2) and div3. all the best for future contests

  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    Just got really lucky the past two contests!

    I really think what Plast told me really helped. Additionally, I tried solving in a way where I tried to focus not on finding a full solution first, but a half-completed solution using more lenient time complexity. I think what this helps is that I can solely focus on trying to optimize my algorithm after finding a bashed solution.

    I'm just fuming over E in CF Round 999, because I worked out a solution in C++ after realizing that my most optimized solution wouldn't meet the time constraints. (Could have solved it 40 minutes faster and 350 points would have been saved not me trying to creating various python solutions to try ensuring I get my second case correct sob)

    • »
      »
      »
      5 weeks ago, # ^ |
        Vote: I like it +1 Vote: I do not like it

      I reviewed your code and found it to be overly complex, with unnecessarily long variable names and an inconsistent approach across submissions. While I am not accusing you of fully relying on AI to generate your solutions, it seems you might be heavily leaning on its assistance. I recommend reviewing the regulations on AI usage, such that you do not unknowingly violate any rules. I apologize if this is simply your coding style, but I want to share my experience; having unknowingly violated a rule in a previous contest by using AI to refactor my code to fix logical errors. I thought it would be helpful to warn you to avoid making similar mistakes, as it is what keeps the integrity of these contests.

      • »
        »
        »
        »
        5 weeks ago, # ^ |
        Rev. 2   Vote: I like it 0 Vote: I do not like it

        Thanks for the thoughtful comment!

        Writing complex code with short variable names is really difficult for me, so I try to write long attributes with names I can remember. I personally think solving questions with smaller variable names only is a bigger sign of cheating, as you can't even explain what you did with your code unless you are a super genius who come with an algorithm right away.

        I thought about your question a bit, since cheating especially in any competition is not a good thing to do. Assuming people do cheat in various levels (I saw a blog post where about 10,000 people cheat using a communication website), surely more people would have gotten more question right, making the rating score inflated.

        The past 2 contests, I got 7/7 and a 5/11, which led me into top 20 in div 3 and 1200 in div 1respectively. While I'm not saying this is entirely my skillset alone (got lucky with questions), I don't think this is a score you can obtain through relying on AI, as that would mean there would be so many more people who would have performed better than me!

        Thank you for the insight on how my approaches are very inconsistent though. Algorithms I learn in 15295 (class at CMU) are the ones I use to solve problems, and I happen to realize the document we use are authored by multiple people, making my code inconsistent, where I use idx for some questions, and index for some other. Maybe this is something I would need to work on to more effectively troubleshoot my code.

        Anyways, thanks for the thoughtful feedback!

        • »
          »
          »
          »
          »
          5 weeks ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          I see, and Im glad I was mistaken. I apologize once again for my earlier assumption.

          Your achievement is truly impressive, especially considering how quickly your rating has grown along with the quality of your code. However, I would recommend studying the solutions provided in editorials and by top participants. Adapting your code to follow their approaches can significantly improve your efficiency in competitive programming (for instance, your solution for A in the previous Div.3 required 3 submissions and was very complicated relative to people at your standing).

          You have lots of potential for such exponential growth. I hope you continue to progress in competitive programming and keep improving. Best of luck to you, Cafune.

    • »
      »
      »
      5 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Yea same. I initially had the correct Idea but was not convinced it will be correct and instead tried to improve an unimprovable dp myself. I only got E in the last 10 minute of the contest.

      Also if you still want more problem solving advice then read the blog (https://codeforces.me/blog/entry/133289) and will recommend you get into the habit of stress testing and proving if your solution is correct (and runtime of the algorithm). You were getting alot of WA not only in E but also in other problems so will be helpful in the long run.

      Also I saw you mentioning CMU 15295, is it this(https://contest.cs.cmu.edu/295/s25/) course? Are you taking it this year?

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

What a jump in rating !!! Congrats!!

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

I love tek it keep up!

»
4 weeks ago, # |
  Vote: I like it +2 Vote: I do not like it

FINALLY!! The cheater got caught!! I felt suspicious after I saw a newbie/pupil solving all div3 and major of div2.... And now I think I was right!! This scammer/cheater just made his/her way to expert and left giving contests... So Mr/Mrs cheater!! Do you have anything in counter?? I'm sure you don't! Its better you admit that u cheated your way to expert..

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    This is disappointing. Many of us actually tried to help.

  • »
    »
    4 weeks ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    Uh no clue, but if my legitimate performance on Div 3 scoring 7/7 isn't enough proof, I really don't know what to tell you ;-;

    I got flagged for question A/B with 50+ individuals. I'm just curious as you are :c

    Additionally, if you check my past submissions, I either use G++17 for questions where python is too slow even with the most optimized solution, or use Python 3 using the same format that I've been using throughout my entire college career.

    I understand that many people find this as very suspicious, but I really don't know what to tell you, as I can't even find the CF handle email to appeal about this ;-;

    • »
      »
      »
      4 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I think maybe you need to post a blog if you think it was a false plag , I did not look into your submission history much but now that i did , i think it is very strange to say the least , maybe it is your style of submitting in different order or you work at a few questions at once , so no one can claim anything .

      I just hope you are legit and can sort this out maybe .

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    rank 20 is actually insane for a person who hardly get rank 5000- in past contests

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

report your inting team mates. focus on split-pushing and maximize your gold income.