A-E Codechef Starters 137 Editorials | Speedrun | Double Trouble | Large Differences | Solutions

Sdílet
Vložit
  • čas přidán 5. 09. 2024

Komentáře • 30

  • @AbhinavAwasthi
    @AbhinavAwasthi  Před 3 měsíci +2

    🔥 Subscribe to coding75 Pro for Live Classes, 1:1 Mentorship Sessions: coding75.com/pro
    ✅ Live DSA Classes
    ✅ Codeforces, Codechef, Leetcode Live Discussion
    1:1 Mock Interviews
    1:1 Mentorship Sessions
    1:1 Resume Review
    ✅ Live Weekly Project Building Sessions
    ✅ Live CS Fundamental Classes
    In case of any queries regarding coding75, WhatsApp us here: wa.me/message/TPN76XLWVOWDB1

  • @gadgetsandhacks7161
    @gadgetsandhacks7161 Před 3 měsíci +4

    SpeedRun solution was too good, thank you for the video Sir.

    • @HarshKumar-xw5nn
      @HarshKumar-xw5nn Před 3 měsíci +1

      It is wrong solution

    • @gadgetsandhacks7161
      @gadgetsandhacks7161 Před 3 měsíci

      @@HarshKumar-xw5nn what is wrong in the solution , is there any edge case we are missing ?

  • @HarshKumar-xw5nn
    @HarshKumar-xw5nn Před 3 měsíci +4

    4 1
    1000 10008 1010 1015
    1000 10 10 10
    Isn't it better to just remove the first moster rather than first loosing moster?

  • @codewme-rm8ru
    @codewme-rm8ru Před 3 měsíci +4

    at 43:51 you said we can go from ind to ind2 which is not true because we want to maximize the health that we are subtracting from the predix sum... so we need to check for both ind and ind2 as extremes and take the maximum of them

    • @harmansingh6003
      @harmansingh6003 Před 3 měsíci

      we have to take all the i from 0 to index such that it leaves a max impact and then we will take maximum of them

    • @raghavnair916
      @raghavnair916 Před 3 měsíci

      Can you give a testcase where ind to ind2 fails

  • @Exam_Rider
    @Exam_Rider Před 3 měsíci +1

    bhai bhi nahi hai behen bhi nahi hai😂😂😂

  • @shreyanshjain1595
    @shreyanshjain1595 Před 3 měsíci

    I HAVE A DOUBT IN DOUBLE TROUBLE PROBLEM:
    jo first case h,jisme ek baal ko right ki taraf throw kr rhe h aur end wali ball ko left mein throw kr rhe h
    us case mein aisa bhi toh ho skta h ki end mein jb dono balls ruk jaye aur unke beech ka gap

  • @MultiBillionaire_Motivation007
    @MultiBillionaire_Motivation007 Před 3 měsíci +1

    Brilliant!!! very well explained

  • @user-cb9id2km2e
    @user-cb9id2km2e Před 3 měsíci +3

    Bro your code failed on this test case, your code is outputting "NO"" but the answer should be "YES". For problem speedrun
    1
    3 1
    10 13 16
    10 4 7

    • @harshithagoud7093
      @harshithagoud7093 Před 3 měsíci

      thank youuu . Now I can sleep peacefully .I have been thinking about the testcase that causes my code to fail .Your testcase helped me .!!!

  • @ronakkriplani1838
    @ronakkriplani1838 Před 3 měsíci +5

    iska he wait tha

  • @cheesebreaker8574
    @cheesebreaker8574 Před 3 měsíci

    Can anyone Elaborate the Idea of Double Trouble with DFS?

  • @ishanmusic677
    @ishanmusic677 Před 3 měsíci +1

    hey abhinav, ive a doubt in question c, there we are checking for every elemnt , but is there any optimal to way to directly choose a number from an array which we can change into 1 or k. Can we do like this-> we'll choose that inex from array which gives the minimum sum of adj diff, and simply we'll replace it with the 1 or k by checking wehich is optimal and calculate the maximum? Please correct me if im wong

    • @priyanshkumar17
      @priyanshkumar17 Před 3 měsíci

      I also thought like this during the contest...but later saw the constraints & saw that checking each & every element would be feasible as N

    • @ishanmusic677
      @ishanmusic677 Před 3 měsíci

      @@priyanshkumar17 right!

  • @ayushsainielite2469
    @ayushsainielite2469 Před 3 měsíci

    alice bhai hi hai shayad ...

  • @39_jatinjain4
    @39_jatinjain4 Před 3 měsíci

    Why 2k on one side in speedrun question??

  • @nikhilbabar2226
    @nikhilbabar2226 Před 3 měsíci +2

    Why to check again the entire sequence again, can't we just check the remaining values which come ahead of bombing area using the build prefix till now. Plz can you tell what's wrong in my code:
    static void solve(){
    int n = i();
    int k = i();
    long[] pos = inputL(n);
    long[] h = inputL(n);
    long prev = 0;
    int i = 0;
    while(i < n && pos[i] - prev > h[i]){
    prev += h[i];
    i++;
    }
    if(i == n){
    pl("YES");
    return;
    }
    long bombArea = pos[i] + 1L*k*2;
    while(i < n && pos[i] h[i]){
    prev += h[i];
    i++;
    }
    if(i == n){
    pl("YES");
    } else {
    pl("NO");
    }
    }

  • @anuragchauhan9887
    @anuragchauhan9887 Před 3 měsíci +1

    Double trouble very easy code and approach 🐷🐷🐷
    void solve() {
    int n;
    cin>>n;
    vectorv(n);
    vectorp(n);
    loop(i,n)cin>>v[i];
    loop(i,n)cin>>p[i];
    int left1=0;
    int right1=n-1;
    int left2=0;
    int right2=n-1;
    for(int i=0;i=v[i+1]){
    left1++;
    }
    else{
    break;
    }
    }
    for(int i = n-1;i>0;i--){
    if(abs(v[i]-p[i])=rt){
    py;
    }
    else{
    pn;
    }
    }

  • @vishwaksenareddymandadi3636
    @vishwaksenareddymandadi3636 Před 3 měsíci

    #include
    using namespace std;
    int main() {
    //Observations:
    //1.Alice has N magical balls on x-axis.
    //2.ith ball at Xi has Pi power.
    //3.the positions are in ascending order.
    //4.Initially no ball is activated.
    //5.Alice can do the following operation at most twice.
    //(i) choose an index i such that ball i is not visited.
    //(ii) mark it visited and choose a direction for it either left or right.
    //6.When ball i is marked visited it will move Pi steps in choosen direction.
    //7.While moving if it strikes with another ball j, ith ball will disappear and the following will happen
    //(i) If j was visited the process ends.
    //(ii) else j is marked visited and moves in the same direction as i.
    //8.If it does't strikeit will stop after Pi steps.
    //9.We need to return if it is possible to mark every ball visited.

    int t;
    cin>>t;
    while(t--){
    int n;
    cin>>n;
    vectorX(n+1);
    vectorP(n+1);
    cin>>X;
    cin>>P;
    vectorvisited;
    visited[0]=true;
    int count=2;
    //Algorithm:
    //we need to store the range for each ball as [Xi-Pi,Xi+Pi].
    //We need to choose the index which is previously not visited and covers maximum range which contain different ball positions.
    //After choosing the maximum we need to choose that index i.
    //And mark all the balls of X in the range as visited along with the ith ball, and decrement count.
    //Repeat the process untill count==0.
    //After this check if all the balls are visited if yes return true else false.

    //ith ball strikes jth ball if number of units moved by i (Pi) makes the position of it >= position of j.

    }
    }
    is there any mistake in the Algorithm I mentioned here??

  • @jatinukey4062
    @jatinukey4062 Před 3 měsíci

    how 2*k come?

  • @user-vx2gg5ok2v
    @user-vx2gg5ok2v Před 3 měsíci

    That voilet color Advertisment is disturbing us. Please remove it and find some other neat way to put in some other place. Its really disturbing

  • @sure9069
    @sure9069 Před 3 měsíci

    where my logic failing?please reply anyine
    for _ in range(int(input())):
    n,k=map(int,input().split())
    X=list(map(int,input().split()))
    p=list(map(int,input().split()))
    f=0
    i=0
    time=0
    use=0
    while i=p[i]:
    time+=p[i]
    i+=1
    elif use==0:
    moveto=X[i]+2*k
    while i

  • @AmitMishra-qs5ru
    @AmitMishra-qs5ru Před 3 měsíci

    JOKES TO HAI GANDE 😂 BUT EXPLAINATION ACHE HAI SIR

  • @user-mz8sv3cl6c
    @user-mz8sv3cl6c Před 3 měsíci

    //why this code has been not worked
    #include
    using namespace std;
    #define int long long
    void solve(){
    int n,k; cin>>n>>k;
    vector v(n); for(auto &i:v) cin>>i;
    if(n == 1){cout