n_k101's blog

By n_k101, history, 22 months ago, In English

Can someone tell ways by which I can keep my mind cool during contests? I don't know how this happens that heartbeat increases (rushing through problem statement skipping important points, like if it is asked to print index, I am printing count of operations) , mind loses its calmness and even easy problems like A and B are done wrong.

Even after practicing regularly this problem remains and I think practicing more problems is not the solution to this "contest-anxiety" issue.

Can someone please guide me who have improved upon these psychological things?

Full text and comments »

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

By n_k101, history, 2 years ago, In English

After using Binary search in Problem C(Round 1574) I am getting TLE I don't know where it is getting out of bounds, please help

code link- https://codeforces.net/contest/1574/submission/181236065

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By n_k101, history, 2 years ago, In English

2 pointer with greedy

I tried to solve the problem using 2 pointer with greedy. It was failing at 1146th test case

My approach was to check if adding the element x to current score will increase it compared to opponents score than add it otherwise just not let the opponent to take their score.

My logic was similar to one of the logics that I found in submissions. The new approach was that I didn.t included the current score of the player and compared only the values if it is greater than that of opponents then add it to the score. This solution worked out. But according to me even if I compare using the current score the answer should be more accurate, which is not the case, what can be wrong please help.

WRONG SUBMISSIONhttps://codeforces.net/contest/1472/submission/177486281

CORRECT SUBMISSIONhttps://codeforces.net/contest/1472/submission/177486439

CODE TO BE COMPARED IN main()

WRONG

 while(i<ev || j<od){
            if(f){
                if(i<ev &&(j==od || a+e[i]>=b+o[j])){
                    a+=e[i];i++;
                }else{                    
                    j++;
                }
                f=0;
            }else{
                if(j<od && (i==ev || b+o[j]>=a+e[i])){
                    b+=o[j];j++;
                }else{                    
                    i++;
                }
                f=1;
            }            
        }

CORRECT

 while(i<ev || j<od){
            if(f){
                if(i<ev &&(j==od || e[i]>=o[j])){
                    a+=e[i];i++;
                }else{                    
                    j++;
                }
                f=0;
            }else{
                if(j<od && (i==ev || o[j]>=e[i])){
                    b+=o[j];j++;
                }else{                    
                    i++;
                }
                f=1;
            }            
        }

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it