Пікірлер
@harisai3580
@harisai3580 14 күн бұрын
Nice and thanks
@manis07
@manis07 28 күн бұрын
hello bro, are you in collge? which year?
@cp_with_vkd
@cp_with_vkd 21 күн бұрын
Hello ! I am a graduate and currently working in a job.
@AbhayJaiswal-g2f
@AbhayJaiswal-g2f 2 ай бұрын
Nice xplanation brother
@llawliet1610
@llawliet1610 2 ай бұрын
Sir,Please explain what i am doing wrong? #include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; int arr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; } int ct = 0; map<int,int> mapp; for (int j = n-1; j >=0; j--) { if ( arr[j]>1 && ((3*arr[j])%(arr[j]-1))==0) { mapp[((3*arr[j])/(arr[j]-1))]++; } ct=ct+mapp[arr[j]]; } cout << ct << endl; } return 0; }
@llawliet1610
@llawliet1610 2 ай бұрын
i got it!!🥳
@ShubhamKumar-nr1ce
@ShubhamKumar-nr1ce 2 ай бұрын
Very nicely explained in detail
@ShubhamKumar-nr1ce
@ShubhamKumar-nr1ce 2 ай бұрын
Great job sir 👍😊
@bishwashkumarsah171
@bishwashkumarsah171 2 ай бұрын
Bro number theory ka video bhi kr do na🥲
@cp_with_vkd
@cp_with_vkd 2 ай бұрын
Bilkul.....jald hi banaunga ❤️
@ShreyaSingh-fz6ho
@ShreyaSingh-fz6ho 2 ай бұрын
Please upload video for D
@BruceWayne-j3v
@BruceWayne-j3v 2 ай бұрын
Helpful !
@cper-pi2sz
@cper-pi2sz 2 ай бұрын
Thanks please upload for C and D also
@uddipan7427
@uddipan7427 2 ай бұрын
why does the longest common substring approach don't work
@cp_with_vkd
@cp_with_vkd 2 ай бұрын
please write your approach in brief
@Sai-ir8yh
@Sai-ir8yh 2 ай бұрын
Could u pls tell why this doesnt work? cin>>a>>b; ans = a.length(); for(int i=0;i<26;i++) { letters[i] = 0; } if(a==b) { cout<<ans<<" "; continue; } for(int i=0;i<a.length();i++) { letters[a[i]-'a']++; } start = 0; for(int i=0;i<b.length();i++) { if(letters[b[i]-'a']>0) { foundAfter = false; for(int j=start;j<a.length();j++) { if(a[j]==b[i]) { if(j>=start) foundAfter = true; start = j+1; break; } } if(foundAfter) letters[b[i]-'a']--; else { ans += b.length() - i; break; } } else ans++; } cout<<ans<<" ";
@Sai-ir8yh
@Sai-ir8yh 2 ай бұрын
i cant think of any test case which doesn't work. so can anyone find out the wrong test case?
@cp_with_vkd
@cp_with_vkd 2 ай бұрын
In subsequence, order of characters should be maintained....at a glance I think this is the error in the code.. .....as you are using frequency array so there might be error in ordering I'll try to find the test case tommorow...
@Sai-ir8yh
@Sai-ir8yh 2 ай бұрын
@@cp_with_vkd Thank you, it would be very helpful. Actually all testcases i can think of, pass
@kohinoor9647
@kohinoor9647 2 ай бұрын
@@Sai-ir8yh a=cabcefg b=bcaefg answer should be 8 ur code will give wrong answer :)
@cp_with_vkd
@cp_with_vkd 2 ай бұрын
My Submission Link : codeforces.com/contest/1989/submission/267765133
@shristisrivastava7054
@shristisrivastava7054 2 ай бұрын
Very nice explanation. Looking forward to more videos.
@khushchoudhary9832
@khushchoudhary9832 2 ай бұрын
how to do this using segment tree
@vaibhavjaiswal8034
@vaibhavjaiswal8034 3 ай бұрын
Great Explanation
@Iammuslim947
@Iammuslim947 3 ай бұрын
I watched many vids everybody was explaining the logic but nobody was explaining the code part like why we r using map and adding freq n all but u explained clearly.well done.👍🏻
@anukulchauhan3636
@anukulchauhan3636 3 ай бұрын
Very well explained and within a perfect time frame.
@GYANKIBAAT-ze7nd
@GYANKIBAAT-ze7nd 3 ай бұрын
Why can't we sort the array and return 2nd last element as it must be biggest among all the median
@cp_with_vkd
@cp_with_vkd 3 ай бұрын
Consider the case : 5 2 1 3 6 In this case ans can never be 5 Because no matter which range you choose 5 can never become median Hence its always not correct to return 2nd largest element We have to check whether it can become median or not
@abhishekrai3
@abhishekrai3 3 ай бұрын
hello sir, apke samjhane ka tarika really bahot achcha hai. Rarely mujhe koi aisi video mili hogi jisme itne detail ke sath kisine explain kiya ho. Thanks alot sir for amzing explanation.
@cper-pi2sz
@cper-pi2sz 3 ай бұрын
Thanks for explaining everything in detail
@cper-pi2sz
@cper-pi2sz 3 ай бұрын
Thanks for the explanation. It is really helpful
@DeepakKumar-mn8yi
@DeepakKumar-mn8yi 3 ай бұрын
4 question bhi explain kar do bhaiya
@cp_with_vkd
@cp_with_vkd 3 ай бұрын
Done !! Video uploaded
@DeepakKumar-mn8yi
@DeepakKumar-mn8yi 3 ай бұрын
sexy explanation
@cper-pi2sz
@cper-pi2sz 3 ай бұрын
Good explanation Please make video on D also
@ShreyaSingh-fz6ho
@ShreyaSingh-fz6ho 3 ай бұрын
Thanks for the clear explanation
@ShreyaSingh-fz6ho
@ShreyaSingh-fz6ho 3 ай бұрын
Nice explanation
@ShreyaSingh-fz6ho
@ShreyaSingh-fz6ho 3 ай бұрын
Good explanation keep making videos it helps us a lot to learn
@cper-pi2sz
@cper-pi2sz 3 ай бұрын
Helpful !! Keep making videos after each contest❤
@vimalkumardubey6834
@vimalkumardubey6834 3 ай бұрын
Small correction at 16:08 ...we have to take next rounded value...5/2 = 3
@PremSagarKPS
@PremSagarKPS 3 ай бұрын
Problem A's solution is wrong In the solution you said, if there are <= 2 segments of sorted array then answer will be YES But, just check the given test cases in the question itself, if array = 1 1 4 5 1 4 answer = No Please explain
@cp_with_vkd
@cp_with_vkd 3 ай бұрын
Thanks for mentioning...ans will not always exist...but as I have said you have to check for both the cases x y and y x If any one of them is sorted Then yes
@cp_with_vkd
@cp_with_vkd 3 ай бұрын
You can refer to The code from description
@vikaskumaryadav5311
@vikaskumaryadav5311 3 ай бұрын
Thanks Bro
@akzytr
@akzytr 3 ай бұрын
why is window 3? Why not 2, so that it would be min of consecutive elements?
@cp_with_vkd
@cp_with_vkd 3 ай бұрын
Yes that will also be correct....but you have to take adjacent as well as...min(a[i] , a[i+2]) Test case : 4 2 4 2 4 2 4 In this if You will consider only 2 elements then ans will be 2 But ans is 4
@akzytr
@akzytr 3 ай бұрын
Oh okay, makes sense
@akzytr
@akzytr 3 ай бұрын
@@cp_with_vkd btw, is that the onlu test case that fails on? alternating with small and bigger?
@cp_with_vkd
@cp_with_vkd 3 ай бұрын
Not necessarily alternating.. This can also be the case 2 4 2 6 1 7 in this ans will be 2 if you consider 2 consecutive...but correct answer is 6
@akzytr
@akzytr 3 ай бұрын
@@cp_with_vkd oh okay, i am now clear on why 2 does not work, but still trouble understanding why 3 will work, why not 4, why not 5.
@wakabaP-d7y
@wakabaP-d7y 3 ай бұрын
thanks!
@formidablechief27
@formidablechief27 3 ай бұрын
great work !!
@ItachiUchiha-ou8mq
@ItachiUchiha-ou8mq 3 ай бұрын
y > 2 pr kse work krega ??
@cp_with_vkd
@cp_with_vkd 3 ай бұрын
2 se bade ke liye bhi karega kaam We are taking one grid at a time and placing maximum number of possible in that grid .... One grid can contain at most 2 boxes of 2x2 and remaining will be covered with 1x1
@cp_with_vkd
@cp_with_vkd 3 ай бұрын
You can refer to my Solution : codeforces.com/contest/1974/submission/261812681
@cp_with_vkd
@cp_with_vkd 4 ай бұрын
Problem C video solution (cat, fox and double maximum) : kzbin.info/www/bejne/jHTUdot4q92Liqcsi=9obFRxs5jW8LnrNk
@bishwashkumarsah171
@bishwashkumarsah171 4 ай бұрын
other youtubers were just using the one liner but i couldnot understand that. ans = min(p1+p2,(p1+p2+p3)//2). can you explain this solution too that is in the editorial. Nice sol
@cp_with_vkd
@cp_with_vkd 4 ай бұрын
If you want the explanation for the O(1) solution, it goes like this: As, we are always increasing p1+p2+p3 by 2 (1,1 in case of draw and 2,0 in case of win), the invariant is pretty clear, i.e.., (p1+p2+p3)%2=0 for a valid game. Now, we have p1≤p2≤p3, so we can always have atleast p1 draws. Thus, from p2 and p3, we have to remove p1 points, leaving us with p2+p3−p1 points. Obviously, in the most optimal case, we could have (p2+p3−p1)/2 more draws (if we had equal points left for both), but this is not necessarily the case as it is possible that p2<(p2+p3−p1)/2, in such a case, we can add p2 to the score. So my final O(1) solution looks like: 1) If (p1+p2+p3)%2≠0⟹ No solution possible. 2) Otherwise, the answer can be found out using the expression p1+min(p2,(p2+p3−p1)/2). Hope this helps!
@dipteshraj9169
@dipteshraj9169 3 ай бұрын
@@cp_with_vkd Absolutely awesome , Now I got it... couldn't understood this o(1) approach by watchinng other yt videos on internet
@TruongBao-z5k
@TruongBao-z5k 3 ай бұрын
@@cp_with_vkd good job thank you
@kshitiz6376
@kshitiz6376 4 ай бұрын
It was really well explained, thanks!
@questions-answered
@questions-answered 4 ай бұрын
thanks
@gautambaranwal445
@gautambaranwal445 4 ай бұрын
Thanks.. :)
@krushikeshshelar4056
@krushikeshshelar4056 4 ай бұрын
Nice approach for the clock and strings problem
@shalinigupta3298
@shalinigupta3298 4 ай бұрын
nice explanation !
@cp_with_vkd
@cp_with_vkd 4 ай бұрын
Thanks ❤️
@ShivamSingh-xv4rw
@ShivamSingh-xv4rw 4 ай бұрын
Nice explanation keep uploading
@cp_with_vkd
@cp_with_vkd 4 ай бұрын
Thanks ❤️
@cs51904
@cs51904 4 ай бұрын
last question ka bhi de do
@cp_with_vkd
@cp_with_vkd 4 ай бұрын
Sure...I will upload it within 1 hr..
@mohamed_bouafif
@mohamed_bouafif 4 ай бұрын
XXVI Interregional Programming Olympiad, Vologda SU, 2024 Do you have solutions for this contest please
@loveuyar4087
@loveuyar4087 4 ай бұрын
Mza Aa gya sir
@cp_with_vkd
@cp_with_vkd 4 ай бұрын
❤️
@amanpatel6203
@amanpatel6203 5 ай бұрын
That's amazing
@narayanipandey4319
@narayanipandey4319 5 ай бұрын
According to your logic that s [ 0 ][ i ] == s [ 1 ][ i - 1 ] then ++count, now consider the 1st testcase of problem, according to you it should be 1 but the ans is 2.
@cp_with_vkd
@cp_with_vkd 5 ай бұрын
ans will be Initialized with 1 because we have already found a path ....now we are looking for how many more paths we can have to get the same string
@dodgehealer4010
@dodgehealer4010 5 ай бұрын
B hint?.?? or code (i will translate to pyhon)