GuptaJi's blog

By GuptaJi, history, 3 years ago, In English

I am not willing to write this blog because in many previous blogs i was flooded with downvotes but i will write because I need a help(I also do not have a friend which is proficient in java to whom i can discuss) from fellow coders in debugging which i am not able to find from last 2 hrs and 10 submission with 7RTE AND 24 AC every time.

I even use LONG , sort array of pairs even in equal case on the basis of index..still not able to figure out the reason of failure.

Q link — https://atcoder.jp/contests/abc187/tasks/abc187_d

My soln link https://atcoder.jp/contests/abc187/submissions/19167083

EVERY TIME I GOT RTE ON FOLLOWING TC- 16,17,18,20,21,22,25

HELP IS HIGHLY APPRECIATED.

Full text and comments »

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

By GuptaJi, history, 3 years ago, In English

I HAD TRIED THIS QUESTION MANY TIMES STILL I GOT TIME LIMIT EXCEEDED ON TEST 18 EVERY TIME . I EVEN USED FEN WICK TREE WHICH IS REQUIRED TO OPTIMISED IN THIS QUESTION . TO THE BEST OF MY KNOWLEDGE I AM DOING GOOD STILL NOT ABLE TO DEBUG IT . PLZ SOMEONE HELP .

THE PROBLEM NAME IS — STRING REVERSAL (1430E)

SUBMISSION LINK- https://codeforces.com/contest/1430/submission/95628601

QUESTION LINK -https://codeforces.com/contest/1430/problem/E

THNX IN ADVANCE :))

UPDATED:DONE NOW ..SO NOW U CAN IGNORE IT ALSO

Full text and comments »

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

By GuptaJi, history, 4 years ago, In English

https://codeforces.com/contest/16/submission/91776859

plz see this link ..i really need help . I know it seems quite lengthy but it is my template which is use in very code .. my main code is just of 8-10 lines ..

PROBLEM : 16C , MONITOR

Full text and comments »

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

By GuptaJi, history, 4 years ago, In English

help in triple sort question from code chef long challenge of may 2020

https://www.codechef.com/viewsolution/32992756

plz tell why i am getting tle?

question is:https://www.codechef.com/MAY20B/problems/TRPLSRT

Full text and comments »

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

By GuptaJi, history, 4 years ago, In English

import java.util.*; public class Main { public static int max(int[] arr, int start , int end) { int max = Integer.MIN_VALUE;

for( int i = start ; i<= end ; i++)
    {
        if(arr[i] > max)
        {
            max = arr[i];
        }

    }



   return max; 
}


public static void main(String[] args)
{
    Scanner scn = new Scanner(System.in);

    int t = scn.nextInt();

    for( int j = 1; j<= t ; j++ )
    {
        int n = scn.nextInt() ;
        int[] arr = new int[n];

        for(int i= 0; i < n  ; i++)
        {

            arr[i] = scn.nextInt();

        }


        int start = 0 ;
        int end ;
        long sum = 0 ;

        for( int i = 1 ; i < n ; i++)
        {
            long x = arr[start]*arr[i] ;
            if(x < 0)
            {
                end = i-1 ;


                sum = sum + max(arr,start ,end) ;

                start = i ;
            }



        }

        end = n-1 ; 
        sum = sum +  max(arr,start ,end) ;

    System.out.println(sum) ;
    }
}

}

Full text and comments »

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