KaryGauss03's blog

By KaryGauss03, history, 4 years ago, In English

Hello there. I am writing this blog to share with you my experience on being Expert in 5 months and to help people who want to imporve their skills in Competitive Programming and even for those who want to start in this field.

And now, let’s start with some important tips from my point of view :

Set your own goals : The good spirit is to fix goals to achieve, for me my goal was to be the first Tunisian who achieve ICPC. And before ICPC, I must be qualified to ACPC (Africa & Arab Collegiate Programming Championship). So I worked hard in the first 4 months, and I was qualified to ACPC by having the 3rd Place in TCPC (Tunisian Collegiate Programming Contest). And to be honnest, it was unexpected for me. But it happens.

You should like what you are doing : If you like a subject, you would be good at it.

while(true) { practice_and_never_give_up () ; }

Select the problems according to the topics you are targeting : This will be very helpful for you during the practice.

Learn new data structures and algorithms : learning new data structures and algorithms (like DFS, BFS, Dijkstra ect ..) will help you to improve your skills. Also, some maths skills can help you to solve some problems faster (Number theory, combinatorics, ect …)

Avoid easy problems : Beginners' problems are a waste of time for who have mastered the basics of competitive programming.

Focus on your performance during contests : don’t look for the scoreboard during the contest. Foncus on your performance and try to solve the problems efficiently. You will sometimes encounter a few defeats and even have a low rating, never mind, it’s normal, try to know your weaknesses and fix them.

Check editorials if you failed : Sometimes you will spend hours trying to find a solution for your problem; in this case you read some lines from the editorial and keep trying again in the problem until you solve it. Even if you can’t solve it, don’t worry, you can read the solution and understand the trick, then re-solve the problem by yourself again.

I hope those tips help you. I want to thank Mtaylor and ziedom for inspiring me and helping me during my trainings.

NOTHING IS IMPOSSIBLE . Start Learning, Start Coding and Start Solving Problems

  • Vote: I like it
  • +63
  • Vote: I do not like it

| Write comment?
»
4 years ago, # |
  Vote: I like it +8 Vote: I do not like it

Congrats!

»
4 years ago, # |
  Vote: I like it -16 Vote: I do not like it

Very Informative. I'll be an expert in the next round with your approach.

»
4 years ago, # |
  Vote: I like it +12 Vote: I do not like it
  • »
    »
    4 years ago, # ^ |
      Vote: I like it +8 Vote: I do not like it

    Thanks bro Good Luck

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

      Congrats, and I bet you by a month :)

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

        Congrats and I bet you by a month :)

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

          Congrats and I beat you by a month :)

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

            Congrats and I beat you by a month :)

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

              Congrats and I don't like violence :)

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

              LoL the next one who will say that would be born with an expert rank

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

        Congrats, and i bet you by a month :)

»
4 years ago, # |
  Vote: I like it -27 Vote: I do not like it

can you kindly tell what all data structures and algorithms like in number theory there are so many algos so among those which all you learnt you learnt along with practice? did you solved cses problem set?

PS: Congrats for becoming expert, wishing you more success. Sorry for my bad English too :-)

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

    Why people are downvoting my comment and Question

    • »
      »
      »
      4 years ago, # ^ |
      Rev. 2   Vote: I like it +14 Vote: I do not like it

      Sadly because your English is really too bad. :(

      I guess you wanna express that what algorithms he has learnt, like DFS or blahblahblah.

      For basics:

      • Recursion (maybe a little more Divide and Conquer)

      • Greedy

      • Prefix Sum

      • Binary Searching

      • Sortings (just being able to use std::sort in C++ and reload the comparing function is enough)

      Searching:

      • DFS

      • BFS

      Dynamic Programming:

      • Knapsack

      • Interval

      • DP On Trees/DAGs

      • Bitmasks (a little maybe)

      • A LOT OF Different DP

      Strings:

      • Hashing is enough

      Maths:

      • Bitmasks (a little)

      • Binary Exponentiation

      • Primes (a little)

      Data Structures:

      • Stack

      • Queue

      • List

      • Union-Find

      • Heap

      • Monotonic Queue (a little)

      • Binary Indexed Tree

      • Segment Tree (only the easiest one)

      • Able to use std::set and std::map in C++

      Graphs:

      • DFS

      • BFS

      • Trees

      • DAG

      • Minimum Spanning Tree

      • Sortest paths (I strongly recommend Dijkstra, that's enough.)

      Don't get scared. Just learning the basics of the algorithms and try to improve in contests. The skill to judge what algorithms to use on a problem is also important. You can try to pick problems with difficulties as high as or a bit higher (like 300 points) than your rating.

      UPD: Learning how to analyze your solutions complexity is VERY important.

»
4 years ago, # |
  Vote: I like it +35 Vote: I do not like it

If you like a subject, you would be good at it.

There are lots of people who actually like CP but are hardstuck in Div. 3.

Learn new data structures and algorithms

Apart from the primitive ones, there are barely any algorithms that you will need to get to blue (or even yellow these days, for that matter).

Focus on your performance during contests

If you focus on your performance, you will get distracted by it regardless of how well you're doing. Instead, focus on the problems.

don’t look for the scoreboard during the contest.

Sometimes a problem that is supposed to be hard is easy, the scoreboard helps you with finding those. In the contest I ranked up to IM, I would have lost rating if I hadn't checked the scoreboard because I wouldn't have known that that particular div1D was easy.

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

    1) Yes, there are people who love CP and find it hard, but they won't give up, they will keep trying and trying. This is why this is an important point. 2) You can't focus on your performance without focusing on the problems. 3) When I said don't look at the scoreboard, I mean don't be stressful about the ranking, you can check which issues are easy or not without looking for the ranking. Just check the number of ppl who solve each problem. The main idea is to look at the CP as a skill to improve, for your job interview or I don't know, and not as a rating. Thank you for your remarks, can you please share your experience with us ?

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

      Yes, there are people who love CP and find it hard, but they won't give up, they will keep trying and trying.

      Not giving up doesn't mean that you are good, neither does it mean that you are improving. Don't you think it would be disheartening and insulting to hear "If you like it, you will be good at it" if you love CP and you have been trying for months if not years to improve but to no avail?

      You can't focus on your performance without focusing on the problems.

      How did you get that idea? There are lots of people that just start complaining about how they're going to lose rating on Discord after getting a little stuck on an early problem, or people that start panicking and start calculating which problems they need to solve in order to not lose rating. I've seen them myself, do you think I'm making this up?

      When I said don't look at the scoreboard, I mean don't be stressful about the ranking

      If so, I agree.

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

        Yeah right, any way I am talking about my experience, and my point of view

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

    there are barely any algorithms that you will need to get to blue (or even yellow these days, for that matter).

    (or even red these days, for that matter). But the OP was talking about very basic algorithms like DFS, BFS etc that are not well known to newbies, so it'll be good if they learn those.

    Sometimes a problem that is supposed to be hard is easy, the scoreboard helps you with finding those.

    That's true, I would also like to add that you can sometimes guess a lot of things about a certain problem's solution just by looking at the standings. (For example, "a lot of people solved this problem in 5~10 minutes, there is probably a hidden observation which will make this solution a 2 liner")

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

      Idk why are u and chromodynam1c is forgetting to tell that without seeing the leader board one can see the dashboard if he wants to see the number of submissions of each problem :(

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

        Doesn't that have the same effect as looking at the leaderboard?

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

          No, not at all... On leader board one can see his rank and his friends' rank which may give tension to him like his friends did a question earlier than him... While on dashboard u can only see the question and number of AC solutions( which will help him to recognize if a question that is supposed to be hard is easy).

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

            Wouldn't seeing that thousands of people solved a problem that you're completely stuck on also give anxiety? Why is seeing your friends any different? I guess for some people seeing the friends leaderboard might be worse, but I still don't think that looking at the dashboard won't make you anxious if you're bothered by the friends leaderboard.

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

      (or even IGM these days, for that matter, not talking about me but other people)

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

Wow, just find that my first contest is on Jan/11/2019 and I became expert on Jun/11/2019, which is exactly 5 months :)

»
4 years ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

I just find it took me 2 months to become expert with 2nd contest on 26 march (during 1st contest, I didn't even know how to take input XD) and becoming expert on 26 may.

»
4 years ago, # |
  Vote: I like it -20 Vote: I do not like it

Hi guys I am doing competitive coding for some time now and got quite experience. I want to know while solving binary search problems how you guys get to know whether it would work or not in one go. for me its always trial and error and I always end up in an infinite loop. Is there some fix method and how to know if some method would work or not

int solve(vector<int>&A, int x, int y,int left, int right){
     while(left<right){ // some times here we get (left<=right)
         
        int mid=left+(right-left)/2;
        // watch(mid);
        if(some_condition(){
            right=mid-1; // some people do right= mid here
            
        }
        else{
            left=mid+1;  //some people do left= mid here
        }
        
    }
    return left;
}
  • »
    »
    4 years ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    A good technique:

    if you are looking for 1st position satisfying some condition do this:

    mid=(left+right)/2;

    if(some_condition()) left=mid+1;

    else right=mid;

    if you are looking for last position satisfying some condition do this:

    mid=(left+right+1)/2;

    if(some_condition()) left=mid;

    else right=mid-1;

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

      what about left< right or left <= right. Also both of these conditions are failing in a problem (painter's partition)

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

        Can you link the problem?

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

          https://www.interviewbit.com/problems/painters-partition-problem/

          #define watch(x) cout << (#x) << " is " << (x) << "\n"
          #define watch2(x,y) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<"\n"
          bool isPossible(vector<int>&A, int x, int y, int k){
             int n=A.size();
             int temp=0;
             for(int i=0;i<n;i++){
                 
                 if(A[i]+temp>k){
                     x--;
                     temp=0;
                     i--;
                     if(x<0){return false;}
                 }
                 else{
                     temp+=A[i];
                 }
             }
             if(temp!=0){x--;}
             if(x<0){return false;}
             return true;
          }
          int solve(vector<int>&A, int x, int y,int left, int right){
               while(left<right){
                   
                  int mid=left+(right-left)/2;
                  // watch(mid);
                  if(isPossible(A, x, y, mid)){
                      right=mid;
                      
                  }
                  else{
                      left=mid+1;
                  }
                  
              }
              return left;
          }
          
          int Solution::paint(int A, int B, vector<int> &C) {
              int sum=0;
              int mod=100000;
              // sort(C.begin(), C.end());
              for(auto it:C){
                  sum+=it;
              }
          
              return (solve(C, A, B, C.back(), sum)%mod*B%mod)%mod;
          }
          
          

          this is my code

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

It's really an incentive for me, thanks a lot. Also, Congratulations on becoming expert!

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

Congratulates!

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

    Congratulations too!

    When I started, I was totally garbage.

    By the way, the spelling of the previous message is quite strange :D

    *I don't know this website previously.

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

    Thank you, Wish you all the best

»
4 years ago, # |
  Vote: I like it +3 Vote: I do not like it

Congrats!

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

Good Job !

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

    Thank you so much bro !

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

      from where did you solve problems and learn data structures?

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

        The famous book CP3 and competitive programmer's handbook Hackerearth, geeksforgeeks and leetcode. And ofc Codeforces

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

Awesome achievement! Keep it up <3