Блог пользователя n_k101

Автор n_k101, история, 23 месяца назад, По-английски

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?

Полный текст и комментарии »

  • Проголосовать: нравится
  • +15
  • Проголосовать: не нравится

Автор n_k101, история, 2 года назад, По-английски

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

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор n_k101, история, 2 года назад, По-английски

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;
            }            
        }

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится