Codeforces Round 952 (Div 4) | Video Solutions - A to H1 | by Viraj Chandra | TLE Eliminators

Sdílet
Vložit
  • čas přidán 10. 06. 2024
  • Here are the video solutions in the form of a post-contest discussion for problems A, B, C, D, E, F, G, H1 of Codeforces Global Round 26. The live discussion was done with students of TLE Eliminators, this is the recording of the same. We hope this will be useful for you in up-solving this contest.
    📢Check out handpicked problems by Priyansh himself, on our CP-31 sheet: www.tle-eliminators.com/cp-sheet
    Solution Codes:
    Problem A - codeforces.com/contest/1985/s...
    Problem B - codeforces.com/contest/1985/s...
    Problem C - codeforces.com/contest/1985/s...
    Problem D - codeforces.com/contest/1985/s...
    Problem E - codeforces.com/contest/1985/s...
    Problem F - codeforces.com/contest/1985/s...
    Problem G - codeforces.com/contest/1985/s...
    Problem H1 - codeforces.com/contest/1985/s...
    Be sure to check out TLE Eliminators.
    Website: www.tle-eliminators.com/
    Instagram: / tle_eliminators
    Linkedin: / tle-eliminators
    Twitter: / tle_eliminators
    TLE Community Discord Server: / discord
    Timestamps:-
    0:55 Problem A
    4:00 Problem B
    12:44 Problem C
    26:22 Problem D
    38:20 Problem E
    1:03:00 Problem F
    1:24:42 Problem G
    1:53:53 Problem H1

Komentáře • 87

  • @TLE_Eliminators
    @TLE_Eliminators  Před měsícem +2

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

  • @shashankvashishtha4454
    @shashankvashishtha4454 Před měsícem +33

    ah, finally Viraj sir, he good PCD very very good, please assign viraj sir always or most of the time.

  • @anubhavmishra9867
    @anubhavmishra9867 Před měsícem +17

    Best explanation for the problems till now

  • @manpatel9157
    @manpatel9157 Před měsícem +18

    Sir, Please upload Leetcode Weekly Contest 401 Solutions. We're addicted to your explanation🥺🙏

  • @deathigniter2155
    @deathigniter2155 Před měsícem +4

    Kya hi pyaara aur bdhia teacher hai.. thank you sir.... baaki sab teachers ko smjhana nahi aata priyansh bhaia.. please let this teacher do all your videos.... he is amazing

  • @shreyanshjain1595
    @shreyanshjain1595 Před měsícem +4

    TLE ELIMINATORS IS IMPROVING DAY-BY-DAY CONTESTS -AFTER-CONTESTS KUDOOS TO THE TEAM
    KEEP IT UP

  • @ankitghosh9873
    @ankitghosh9873 Před měsícem +4

    Intuition + world class explanation !
    Please TLE make all the editorials by Viraj and Gaurish,They are LGM at explanation ! other than these two all are newbies . Guys if you agree like the comment so that they can hear asap

  • @TFue01
    @TFue01 Před měsícem +3

    loved the explanation of the E question was absolutely on point

  • @the_ghost_of_uchiha5939
    @the_ghost_of_uchiha5939 Před měsícem +6

    Great explanation Sir! 😇
    Those who are trying for problem F the working range of r is 1e13 not 1e18.So don't take more than that.
    Because in worst case :
    power[i] = 2*1e5
    cooldown[i]=1
    and mid=(0+1e13)/2 => 1e13/2;
    Therefore, attack Power at that moment (2*1e5*1e13)/2 ==> 1e18.
    Therefore range of 'r' more than that won't work.

  • @lofibeats2344
    @lofibeats2344 Před měsícem +1

    The way you explained g with the exact intuition you had during contest is just awesome. Keep this quality

  • @NITISHMISHRA-nr8fi
    @NITISHMISHRA-nr8fi Před 12 dny

    man this is like so good . these kind of explanation with intution is what makes a difference !

  • @pratyushdubey5362
    @pratyushdubey5362 Před měsícem +3

    Thanks for such a detailed explanation.

  • @puneet6946
    @puneet6946 Před měsícem +1

    Great explanation, I've seen a lot of people do this but they all skip some or the other steps but this was just fantastic.
    I hope you continue the good work 😊

  • @pabitrakb5291
    @pabitrakb5291 Před měsícem +1

    Thank you for this
    Great explanation

  • @RashedunnabiRashed
    @RashedunnabiRashed Před měsícem +1

    Awesome explanation viraj🎉

  • @priyanshubari9685
    @priyanshubari9685 Před měsícem +1

    great explanation. keep it up!

  • @AyaGamal2010
    @AyaGamal2010 Před měsícem +1

    Thanks!

  • @Gyanpapi_
    @Gyanpapi_ Před měsícem +1

    I did like the way he explained ,super

  • @dipanshuraj18
    @dipanshuraj18 Před měsícem +2

    In 3Q. (Good Prefix) If we take an array 1 2 2 3 then 5≠3 but 2+2=3+1 so it's a good array but it won't be counted according to the given solution....
    Please help me out

    • @VirajChandra
      @VirajChandra Před měsícem +1

      Only one element has to be equal to all sum.

  • @channel-te5vk
    @channel-te5vk Před měsícem +2

    In F . Try setting the high pointer =h *(2e5). This will work. Because worst case scenario is attack is 1 and its turn is 2e5

    • @VirajChandra
      @VirajChandra Před měsícem

      A pointer for 10^12 works. Base point, try not to overflow. Had this been python we would have been good enough.

    • @channel-te5vk
      @channel-te5vk Před měsícem +3

      @@VirajChandra Yes exactly.

    • @AyushGupta-ux4gq
      @AyushGupta-ux4gq Před měsícem +1

      Thanks bro

    • @user-xm6ue3cy2k
      @user-xm6ue3cy2k Před měsícem

      @@VirajChandra can you explain why we should take higher limit r = 1e18 ?
      can't undestand that.

  • @kevinjoythomas6528
    @kevinjoythomas6528 Před měsícem +1

    good explaination

  • @harshyadav4-yearb.tech.che634
    @harshyadav4-yearb.tech.che634 Před měsícem +2

    F is testcse pe nhi chlega.Jab n ki value 2*10^5 ho,saare ai ki value 2*10^5 ho aur saare ci ki value 1 ho. Fir hum log jo sum le rhe hai loop me wo overflow kar jayega. Isliye apne ko loop me hi check karlena chahiye aur jaise hi sum health se bada hota to whi pe break kar dena chahiye.

    • @VirajChandra
      @VirajChandra Před měsícem +1

      Hi, not exactly this, since I already have a check for h health becoming zero. So if everything is 2*10^5 then h becomes zero before going to BS.
      Correct hack to my solution would be if we give some case where I don’t exhaust h before going to BS. Anyways, hacking is fun!
      I’ll change the submission link so that we get a better solution.

    • @harshyadav4-yearb.tech.che634
      @harshyadav4-yearb.tech.che634 Před měsícem

      @@VirajChandra okay got it

  • @vickyroy3595
    @vickyroy3595 Před měsícem +1

    i too got same intutuion when i look into problem d

  • @jackma9528
    @jackma9528 Před měsícem +1

    sir, i'm having an issue, i can't solve div2 problems but i'm not complete newbie, shld i join level2 tle course

  • @ishwarreddy8820
    @ishwarreddy8820 Před měsícem +2

    want discussions for every contest

  • @user-xm6ue3cy2k
    @user-xm6ue3cy2k Před měsícem

    in problem F , why did you take higher limit = 1e18?

  • @rituraj6752
    @rituraj6752 Před měsícem +2

    Viraj bhaiya god op

  • @NOWSHINTABASSUM-vg8lx
    @NOWSHINTABASSUM-vg8lx Před měsícem +1

    aaap best ho jiii.......

  • @gnanaprakash-ravi
    @gnanaprakash-ravi Před měsícem +3

    Hi Viraj sir. Your vs code sectioning looks awesome. Please teach us how to set it up. Thanks!!

    • @VirajChandra
      @VirajChandra Před měsícem +1

      Sure, I'll try to cover a video on it.

  • @MDHabibur-qk7pj
    @MDHabibur-qk7pj Před měsícem +1

    r=10^18 dosen't work. use 10^12 instead of 10^18. it works prefect

    • @VirajChandra
      @VirajChandra Před měsícem +1

      Hi! Yes, you are correct. I have cleared this out in the other comments and also attached the correct submission link.

  • @rachakondaeshwar4129
    @rachakondaeshwar4129 Před měsícem +6

    F is an easy binary search on the answer . Missed it...

    • @gigachad2419
      @gigachad2419 Před měsícem +2

      Mine got hacked anyways

    • @ramanujangunturu4996
      @ramanujangunturu4996 Před měsícem +1

      I did try like that but it didn't work for me though

    • @geethakarnati
      @geethakarnati Před měsícem +1

      Could anyone tell that test case where binary search getting wrong

    • @Idk-qg7hb
      @Idk-qg7hb Před měsícem

      @@geethakarnatikyu mc?

    • @Idk-qg7hb
      @Idk-qg7hb Před měsícem

      @@geethakarnatihack karega?

  • @prakashgk-tz3fv
    @prakashgk-tz3fv Před měsícem +1

    In question E, k % ( a * b) and k /(a * b)

    • @VirajChandra
      @VirajChandra Před měsícem

      Hi! Since side c has to be integer, a*b should fully divide k. Hence k%(a*b). Next, whichever side value you get has to be less than equal to z, since your side c cannot go above z. Hence second condition.

    • @prakashgk-tz3fv
      @prakashgk-tz3fv Před měsícem

      @@VirajChandra Okey sir got it thank you

  • @selvaarumugam370
    @selvaarumugam370 Před měsícem +3

    F will also work on priority queue it passed for me

    • @vanshrana7807
      @vanshrana7807 Před měsícem

      +1

    • @VirajChandra
      @VirajChandra Před měsícem

      That’s great! I mentioned in the video that I did not give alot of thought to the time complexity of a quick implementation in priority queue, so I went ahead with bs. It’s nice that you were able to solve it using priority queue.

    • @gigachad2419
      @gigachad2419 Před měsícem +1

      Plz share Submission and Approach

    • @gigachad2419
      @gigachad2419 Před měsícem +2

      @@VirajChandra Sir can you please share the approach with priority queues

    • @vanshrana7807
      @vanshrana7807 Před měsícem

      @@gigachad2419 here is the approach just maintain a minheap where you keep the next time when you can use ith attack :
      #include
      using namespace std;
      #define ll long long int
      #define uni unsigned long long int
      #define pb(x) push_back(x)
      #define sz(arr) arr.size()
      #define ssz(s) s.length()
      #define nl endl
      #define read(arr,n) for(ll i=0;i>arr[i]
      #define srt(arr) sort(arr.begin(),arr.end())
      #define srtr(arr) sort(arr.rbegin(),arr.rend())
      #define rev(arr) reverse(arr.begin(),arr.end())
      #define pi pair
      #define pl pair
      #define vi vector
      #define vll vector
      #define vuni vector
      #define vpi vector
      #define vpl vector
      #define vii vector
      #define vlll vector
      #define mn(a) *min_element(a.begin(),a.end())
      #define mx(a) *max_element(a.begin(),a.end())
      #define vs vector
      #define vss vector
      #define vc vector
      #define vcc vector
      #define pre_sum(pre,arr,n) for(i=1;i=0;i--) suf[i]=suf[i+1]+arr[i]
      const double pie=3.14159265358979323846264338327950;
      const ll mod=1e9+7;
      ll gcd(ll a,ll b){
      while(a!=0 && b!=0){
      if(a>b) a%=b;
      else b%=a;
      }
      if(a==0) return b;
      return a;
      }
      class cmp{
      public:
      bool operator()(pl p1,pl p2){
      return p1.first>p2.first;
      }
      };
      int main()
      {
      int t;
      cin>>t;
      while(t--){
      ll h,n,time=1,p=0;
      cin>>h>>n;
      vll a(n),c(n);
      read(a,n);
      read(c,n);
      priority_queue pq; //p.first=time,p.second=index
      for(ll i=0;i

  • @yashupadhyay8909
    @yashupadhyay8909 Před měsícem +1

    how are you able to submit a solution at 5: 38 pm ??

  • @YashDabhade-cr5my
    @YashDabhade-cr5my Před měsícem +1

    Sir, why your solution of F got hacked

    • @VirajChandra
      @VirajChandra Před měsícem +1

      Initially, when I put a check for h being negative, I thought that would suffice the overflow check. But I think we can bypass it, so keeping high as a lower value works now. Solution has been updated.

    • @YashDabhade-cr5my
      @YashDabhade-cr5my Před měsícem +1

      @@VirajChandra got it

  • @001_abhijeetkumar7
    @001_abhijeetkumar7 Před měsícem +1

    can anyone help me with this, i am using priority queue and getting wrong answer at test case 16
    #include
    using namespace std;
    int main(){
    long long t;
    cin>>t;
    vector ans;
    while(t--){
    int h,n;
    cin>>h>>n;
    vector damage(n),cooldown(n);
    for(long long i=0;i>damage[i];
    for(long long i=0;i>cooldown[i];
    priority_queue pq;
    for(long long i=0;i

  • @Phoenix-dd3kb
    @Phoenix-dd3kb Před měsícem +2

    How can I change my c++14 compiler to c++17 I have the required gcc version....Anyone please help