Codeforces Round 976 (Div 2) | Video Solutions - A to E | by Gaurish Baliga | TLE Eliminators

Поделиться
HTML-код
  • Опубликовано: 22 окт 2024

Комментарии • 50

  • @TLE_Eliminators
    @TLE_Eliminators  23 дня назад

    Please fill the feedback form for PCD: forms.gle/TamiaQyjCaXYobzP7

  • @frouMagician
    @frouMagician 23 дня назад +2

    your explanations are crisp and to the point! Love it

  • @AppMaruf
    @AppMaruf 21 день назад +5

    Can u explain why we will use c++ 20? in A

  • @lakshaydhiman4056
    @lakshaydhiman4056 22 дня назад +1

    Nice explanation sir, i have never solved problems on probability and modular inverse. Solution was a great help

  • @debug_head
    @debug_head 8 дней назад

    Problem C - Is this a general way to solve such Bitwise equations ?
    And can work in almost all such equations ?

  • @MikasaAckerman-v8o
    @MikasaAckerman-v8o 22 дня назад +1

    Very great explanation

  • @MindMingle-x3j
    @MindMingle-x3j 23 дня назад +7

    hey ,where to practice mathematical question like 1st or 2nd one.

  • @balasubramania3280
    @balasubramania3280 22 дня назад +1

    Hey can you please add time stamps for A, B , C, D, E so that we navigate easily

  • @ishanmusic677
    @ishanmusic677 22 дня назад +2

    use long long and submit in c++20 (if anyone getting tle)

    • @AppMaruf
      @AppMaruf 21 день назад +1

      Can u explain why we will use c++ 20?

    • @ishanmusic677
      @ishanmusic677 21 день назад

      @@AppMaruf im not sure but ig c++20 comes up with some optimization in stl and better run time behaviour, so due to that the same solution got accepted which is giving tle in c++17

  • @harshitkumar4129
    @harshitkumar4129 21 день назад

    E constraints were too tight. This complexity N*M is not expected for E.

  • @rlm3227
    @rlm3227 19 дней назад

    Great explanation for B

  • @AppMaruf
    @AppMaruf 22 дня назад +1

    Can u explain the time complexity of A?

  • @aditisingh-i8o
    @aditisingh-i8o 22 дня назад +1

    Using dfs on graphs in D gives MLE on test case 7

    • @gaurishbaliga3723
      @gaurishbaliga3723 21 день назад

      You need to optimise adding edges. Like in my solution code, if you replace DSU.unionset by the push_back we do for graphs, it should work

  • @harshalgupta3453
    @harshalgupta3453 22 дня назад

    The algorithm for problem B is is giving wrong answer on 8 th test case in java:
    import java.util.*;
    public class State{
    public static void main(String args[])
    {
    Scanner scm=new Scanner(System.in);
    int t=scm.nextInt();
    for(int a=1;a

    • @colgate1602
      @colgate1602 22 дня назад

      I am a c++ user but from I guess I think your Math.sqrt() function takes double for input, but you need long double for input, so you should use binary search for taking out the sqrt or check out if there is a function in java that takes long double for input. Similar thing happened to me where my sqrt() function didn't worked, so I had to use sqrtl() which is new to me

    • @harshalgupta3453
      @harshalgupta3453 21 день назад

      @@colgate1602 thanks buddy !!

  • @Artisto-E7
    @Artisto-E7 22 дня назад +2

    I just copy and paste your code(problem A). But it's getting TLE in 5th test case ?

    • @aniketgupta8903
      @aniketgupta8903 22 дня назад +1

      Yea, It's TLE, they are expecting O(n)

    • @GopalYadav-re5rm
      @GopalYadav-re5rm 22 дня назад

      Try submitting in c++ 20 it will work

    • @AppMaruf
      @AppMaruf 21 день назад

      @@GopalYadav-re5rm Can u explain why we will use c++ 20?

  • @mahedihasananik254
    @mahedihasananik254 22 дня назад

    Why we are still looking for mid in the else statement after setting answer equal to mid?
    In the else statement why we are still doing r=mid-1 after setting the answer equal to mid?
    In the problem B.

    • @rounakpatra3406
      @rounakpatra3406 22 дня назад +1

      Because we have to minimize our n
      There can be multiple n for which exactly k bulbs will light up and we have to choose the minimum no of bulbs
      hence once we get an possible n we are storing it in answer and looking for smaller n to check wether can we achieve the desired state of exactly k bulbs that are on

    • @weeblyoverloaded3824
      @weeblyoverloaded3824 22 дня назад +1

      we want to find the minimum answer, when our on > n that means we have a value which can be our answer but as we want the minimum value we will look on left side to find the least value

  • @Aryan_083
    @Aryan_083 22 дня назад +5

    problem A is giving tle in test 3 in java

    • @sukuna_real-u9x
      @sukuna_real-u9x 21 день назад

      yes, check codeforces editorials they do upload the codes.

  • @GopalYadav-re5rm
    @GopalYadav-re5rm 23 дня назад +3

    The first code is now giving tle on 5th test case
    UPDATE: Sorry guys I was submitting In c++ 17 which is getting tle whereas c++20 It is getting accepted no idea why

    • @tervicke487
      @tervicke487 23 дня назад

      i used similiar approach and got accepted , u might be be going wrong somewhere with the loop causing an infinite loop.

    • @mahadevpnair3196
      @mahadevpnair3196 22 дня назад

      @@tervicke487 Can you share your code? I am getting TLE on 5th too.

    • @gaurishbaliga3723
      @gaurishbaliga3723 22 дня назад

      Its probably because I have defined int as long long in my code and you haven’t causing an integer overflow

    • @mahadevpnair3196
      @mahadevpnair3196 22 дня назад

      @@gaurishbaliga3723 It's Time Limit Exception, not any other kind of error.

    • @gaurishbaliga3723
      @gaurishbaliga3723 22 дня назад

      @@mahadevpnair3196Do share your code, let me look into it

  • @moopoo-h2u
    @moopoo-h2u 21 день назад

    When Update problem F my bro, i really wanna solve that

  • @Vegito-ew3gn
    @Vegito-ew3gn 23 дня назад +3

    Gaurish sir is lit🔥🔥

  • @SusieSnaples-q1t
    @SusieSnaples-q1t 16 дней назад

    Rolfson Parkway

  • @pr_inv8
    @pr_inv8 21 день назад

    can u explain this in case of k = 10 ^ 18 its answer = 1000000001000000000 why not its 1000000000099999999??

  • @VasuBhalani
    @VasuBhalani 22 дня назад

    please help me same code in c++ why not run in java.
    import java.util.Scanner;
    public class problema {
    public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int t = sc.nextInt();
    while (t-- != 0) {
    long k = sc.nextLong();
    long maxans = (4 * (long) Math.pow(10, 18)) ;
    long low = 1L;
    long high = maxans;
    long myans = 0L;

    while (low

  • @danielhack096
    @danielhack096 22 дня назад

    g

  • @danielhack096
    @danielhack096 22 дня назад

    w