Codeforces Round 895 Div 3 | A B C D E | Video Editorial C++

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

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

  • @varunpunia11
    @varunpunia11 Год назад

    Amazing explanation!
    Keep uploading videos.

  • @rsip11
    @rsip11 Год назад

    Did E with prefix sum.
    Calculated initial 0_xor and 1_xor.
    Then say if some segment is flipped, for 0_xor(same for 1_xor) we have to remove XORs of elements which were initially 0 and add XORs of elements which become zero after the flip.
    Taking the xor of this segment
    (arr[l]xor arr[l+1].....xor arr[r])
    with 0_xor will directly achieve this,
    >Elements corresponding to 0 before flip will get removed as A xor A=0
    >And if they didn't get removed means they corresponded to 1 before the flip.
    Also if you don't mind, I think a brief section discussing your line of thought for the problem you couldn't solve would be nice.

    • @cpwithcpp
      @cpwithcpp  Год назад +1

      Yes that makes sense. And again you don't need to have to calculate both values separately. You can just calculate one of them.
      And I don't discuss the unsolved problems because my idea might be completely wrong. So I don't want to give wrong ideas to the people watching these videos.

  • @daisyprakashkhoja5160
    @daisyprakashkhoja5160 Год назад +1

    what extesion you are using for showing and hiding the tags of the problem on codeforces ??

    • @cpwithcpp
      @cpwithcpp  Год назад +1

      Hi
      I have made that extension and that is called Codeforces GetRating. You can find it on Chrome as well as Firefox web store.

  • @jobair541
    @jobair541 Год назад

    In the problem B, why did you take the most minimum distance of all the distances?

  • @u_nknown4O4
    @u_nknown4O4 Год назад

  • @ichigokurosaki7120
    @ichigokurosaki7120 Год назад

    what are the resources you recommend for learing segment trees

  • @kannank4269
    @kannank4269 Год назад +1

    For problem C, how do you arrive that I have to find prime divisor for odd case

    • @cpwithcpp
      @cpwithcpp  Год назад

      You will realize that the odd case is just a generalization of the even case. 2 is also a prime divisor of any even number.
      If I want gcd to be greater than 1 then there must be something common between the two numbers and if b is a multiple of a then a can definitely be the gcd.

    • @kannank4269
      @kannank4269 Год назад

      @@cpwithcpp got it

    • @khitijkarmakar
      @khitijkarmakar Год назад

      I did the question in a different way , I made 3 cases when the difference between numbers is 0 , 1 and >=2

    • @farmaankhan6669
      @farmaankhan6669 Год назад

      prime number are aways odd

  • @arafhasan504
    @arafhasan504 Год назад

    In the problem C, what to do when l == r and r is odd and I cant find any prime factors? I cant solve the last sample input , 9840769 9840769,

    • @faiazmahmud6277
      @faiazmahmud6277 Год назад +1

      I did it in this way:
      U need to search if there is any composite number from l to r
      If u find one print its first factor and the other one is (composite number - first factor)
      And in case u don't find one output -1

    • @cpwithcpp
      @cpwithcpp  Год назад +1

      9840769 has 3137 as a prime divisor.
      So you answer can be 3137 and (9840769 - 3137)

    • @arafhasan504
      @arafhasan504 Год назад +1

      thank you so much guys