After the contest, I was looking into other solutions but really I didn't get it anything and now I was waiting for the editorial and to my surprise, you made a video with a clear explanation to it. Thanks, bro keep making videos on C and D codeforces problems. it really helps a lot.
In brief: Standard algo to be known : Prefix trick : For finding zero and one change required pairs some adhoc thinking : Using map for finding zero changing pairs (this is awesome) Remainging is two changing pairs Thanks buddy! Awesome thinking! Hope i get these kind of thoughts on one kind. Until then practice, participate, Don't lose the adrenaline rush and don't lose hope.
Thanks man I wasn't able to get it by my own after checking so many solutions but after watching your video now I understand the logic thank you Thanks for helping beginners programmes
Thanks a ton for the explanation, I couldn't understand the tutorial and was searching for clarity in the comments when I came across your link to your explanation!
From the beginning part of my journey at cp I want to upsolve problems and for beginners problem c and problem d is not such easy to understand by editorial in short time but this videos really helped me to understand this easily. KEEP GOING ON BUDDY BE LIKE THAT FOR EVERY PROBLEM OF CODEFORCES
the basic query problem that u solved using prefix sum , i am known to that method already , i solved a problem in GFG array section using this , the question was " you will be given some ranges and you have to print the most repeated element with in the range " , i almost solved the question with basic prefix sum concept , i mean i guessed it will be like this but i was all the time putting the negative values ( that help us to indicate wheres it ending ) to the upper limit index rather than the next element to the range's upper limit, BUT this question was beyond my reach , though i am having only 2 months into serious programming still it hurts when you cant find the solution on your own :(
Participated in virtual content and couldn't solve it, i dind't understood editorial and other's solution, then found your editorial and before watching it i was like " striver bhayya ne editorial banaya hai to samajh a hi jayga" and guess what ,at 11 min i paused the video and coded the solution and ACed. Also today i learned a new technique of prefix . Thank you bhayya.
Really a very nice explaination. For the prefix trick I used to do it with BIT. I thought of this trick earlier but didn't use earlier. But thanks to you now I have two techniques.😄
Thanks a lot brother. I understood every part of the solution. Before your solution I was searching different solutions but understood nothing. Thanks a lot😃😃
I doing the cp list I understand the algo but can't get sol , so watched this video 4 times and I finally get its best use of scanline algo.thnks bhaiya
Suppose I had an array { 3, 4, 5, 6} (non zero based indexing here) And I have two queries Q1 : from 1 to 3rd index add -1 Q2 : from 2 to 3rd index add 2 And then in the end tell the sum of array elements between index 2 and 4 (1 and 4 are inclusive). In this thing I am not able to use scanline algorithm
Best explanation friend thanks for making such quality content. Understood every part of it and thanks for explaining also the underlying algos behind the problem. You are really the best.
i watch your video it is best, your way of explanation is best ,if possible kindly try to give solution of some practice problem of dp,graph of medium level difficulty c,d,e
Learn basic programming with loops and stuffs, keep learning Data Structures, different Algorithms starting from basic one. Keep solving problems related to those algorithms once u have learned the Algo. Try to participate at every contest at Codeforces, after the contest try to do the first two questions that you could not do. To improve in CF, practice questions from a2oj static ladder.
Prefix table gives u which pairs are having 0/1 changes, so you to know the pairs which gives 1 changes, you have to subtract them. Hence table can say it directly how many needs to be subtracted.
@@takeUforward sir i saw your profile on CF like initially you have given every contest. I wanted to ask that after giving the contest do you review the problems again ? And if so you just look at the soln or try it.? And how many questions do you tend to review after contest overs. I hope you will reply
I wanted to be expert this contest, but instead got a negative 50 delta. Please tell me how I can improve my speed coding abilities. I took 30 minutes to code only problem C!
This is the code i wrote, i may be wrong too, please correct me t=int(input()) for _ in range(t): n,b=map(int,input().split()) arr=list(map(int,input().split())) ans=float("inf") m={} pairs=int(n/2) ind=[0]*((2*b)+1) for i in range(1,int(n/2)+1): if arr[i-1]+arr[-i] in m: m[arr[i-1]+arr[-i]]+=1 else: m[arr[i-1]+arr[-i]]=1 for i in range(1,int(n/2)+1): ind[min(arr[i-1],arr[-i])+1]+=1 if max(arr[i-1],arr[-i])+b+1
This works bro, the answer is 0, which the code gives. If you take x = 3, so 0 changes are 2 pairs, 1 changes are 0 pairs, 2 changes are 0, hence total pairs left to be changed is 0, hence count is 0*2 = 0 changes.
@@j.shreyansh am really bad at debugging a code of a language am not familiar to. I have the code link in the description, please compare to it, by using print statements. Try putting print and check if your values and my code values are coming same or not. In this way you can figure it out.
After the contest, I was looking into other solutions but really I didn't get it anything and now I was waiting for the editorial and to my surprise, you made a video with a clear explanation to it. Thanks, bro keep making videos on C and D codeforces problems. it really helps a lot.
Glad it helped!
In brief:
Standard algo to be known : Prefix trick : For finding zero and one change required pairs
some adhoc thinking : Using map for finding zero changing pairs (this is awesome)
Remainging is two changing pairs
Thanks buddy! Awesome thinking! Hope i get these kind of thoughts on one kind. Until then practice, participate, Don't lose the adrenaline rush and don't lose hope.
Thanks man I wasn't able to get it by my own after checking so many solutions but after watching your video now I understand the logic thank you
Thanks for helping beginners programmes
Glad to hear that
Hi atishay
Hi
One of the best Recommendation RUclips has ever gave me. Thanks bro for such beautiful content. Keep making such videos :)
Even after struggling for 1.5hr, was unable to solve it. Thank you for the video. Great explanation!!
Glad it helped!
Thanks a ton for the explanation, I couldn't understand the tutorial and was searching for clarity in the comments when I came across your link to your explanation!
I JUST WANTED TO SAY THAT PLEASE DONT STOP THIS GOOD WORK because i started the same but stopped... I HOPE YOU WILL KEEP GOING as it really helps
From the beginning part of my journey at cp I want to upsolve problems and for beginners problem c and problem d is not such easy to understand by editorial in short time but this videos really helped me to understand this easily. KEEP GOING ON BUDDY BE LIKE THAT FOR EVERY PROBLEM OF CODEFORCES
the basic query problem that u solved using prefix sum , i am known to that method already , i solved a problem in GFG array section using this , the question was " you will be given some ranges and you have to print the most repeated element with in the range " ,
i almost solved the question with basic prefix sum concept , i mean i guessed it will be like this but i was all the time putting the negative values ( that help us to indicate wheres it ending ) to the upper limit index rather than the next element to the range's upper limit,
BUT this question was beyond my reach , though i am having only 2 months into serious programming still it hurts when you cant find the solution on your own :(
I had no idea about this prefix table, once I understood the logic from your explanation, i solved it easily
if only i was not a student I would have applauded.Nice Explanation my friend
No issues man. You commented, thats more than enough :)
Participated in virtual content and couldn't solve it, i dind't understood editorial and other's solution, then found your editorial and before watching it i was like " striver bhayya ne editorial banaya hai to samajh a hi jayga" and guess what ,at 11 min i paused the video and coded the solution and ACed. Also today i learned a new technique of prefix . Thank you bhayya.
Really a very nice explaination. For the prefix trick I used to do it with BIT. I thought of this trick earlier but didn't use earlier. But thanks to you now I have two techniques.😄
Yeah BIT is better if it had updates, but here we have no updates.
Thanks for such a wonderful explanation. finally I understood the solution of this problem. Thanks for your effort.
Thanks for the video. Making one video on one topic explaining it thoroughly is what I like the most.
Thanks a lot brother. I understood every part of the solution. Before your solution I was searching different solutions but understood nothing. Thanks a lot😃😃
Nice video, and explaining the underlying algorithm separately is a good way to understand problem. Great !!
I doing the cp list I understand the algo but can't get sol , so watched this video 4 times and I finally get its best use of scanline algo.thnks bhaiya
Thank you so much. I finally understood it. Keep making solution videos for newbies like me.
thanks, man for such an explanatory video keep making cf c & d problems vides, It helps a lot.
Good explanation. Your write clean code, makes understanding the stuff easier. Thanks :)
Suppose I had an array { 3, 4, 5, 6} (non zero based indexing here)
And I have two queries
Q1 : from 1 to 3rd index add -1
Q2 : from 2 to 3rd index add 2
And then in the end tell the sum of array elements between index 2 and 4 (1 and 4 are inclusive).
In this thing I am not able to use scanline algorithm
Best explanation friend thanks for making such quality content. Understood every part of it and thanks for explaining also the underlying algos behind the problem. You are really the best.
Great tutorial! Thanks for providing good quality content!
Please go on making codeforces rounds video tutorials....it helps a lot
Thank u so much!! Keep uploading solution videos of Div.3 and Div.2
really awesome explanation!!!!
keep it up bro.
good explanation it helps too much ...keep making videos ❤
Thank you So much ! Please keep it up it is very helpful.
Sure thing!
Great use of prefix sum..and nicely expained !
I'm bit confused which part of the solution uses exactly Scanline Algorithm Directly or Indirectly
When you are building the prefix array, from the ranges L, R for every pair. The prefix trick is the scanline algo.
Thanks for the great video, can you suggest on how to solve problems in cf contets quickly?
Practice, do as many problems u can in a day that really helps.
AWESOME EXPLANATION
keep doing more videos bro :)
Struggled for 1.5 hour yesterday 😂😂😂😂
Haha!
relatable👍
This is sheer brilliance man, but I want to understand if there isn't a way to solve it using binary search? if yes can you leave a tip?
i watch your video it is best, your way of explanation is best ,if possible kindly try to give solution of some practice problem of dp,graph of medium level difficulty c,d,e
great tutorial man! hope to see some more of them. cheers!
Thanks for this really simple and clear explanation . great efforts.
CAN YOU PLEASE TELL ME WHICH IDE YOU ARE USING??
Added a video for it.
That was very clear Thanks Man
int l = it.fi + 1;
int r = it.se + k;
why u have added it.f1+1 && se+k ??
not getting bro how u maintained prefix array in the solution .
simply superb bro very nice explanation.
This algorithm is brilliant!!
Out of context question, but which digital pen you use for writing/drawing on pc? anyway great video learned new algo.
I use one from wa'com!
Can you please help? What is prefix sum trick and how will we make prefix table in O(n). Shouldn't be it O(n.k)?Please help!
Initially I have made it, you can have a check in the code link in the description.
How to start with programming and the sources for learning?
Learn basic programming with loops and stuffs, keep learning Data Structures, different Algorithms starting from basic one. Keep solving problems related to those algorithms once u have learned the Algo. Try to participate at every contest at Codeforces, after the contest try to do the first two questions that you could not do. To improve in CF, practice questions from a2oj static ladder.
Striver can you give some place where I can find this scan line trick ?
great explanation. Really helped.
Keep making videos buddy , you are just improving my threshold point thanks 👍👍
Glad to hear that
thank you for this video too!!
Sir , What will be the use of hash table as from the prefix array we will get the total possibilities ?
Prefix table gives u which pairs are having 0/1 changes, so you to know the pairs which gives 1 changes, you have to subtract them. Hence table can say it directly how many needs to be subtracted.
@@takeUforward yes yes i got it. Thanks very much.
@@takeUforward sir i saw your profile on CF like initially you have given every contest. I wanted to ask that after giving the contest do you review the problems again ? And if so you just look at the soln or try it.? And how many questions do you tend to review after contest overs.
I hope you will reply
bro nice explanation.pls keep posting
Read about "Difference Arrays" to understand this better.
great explaination 😍
Glad it was helpful!
How do manage the problem of infinite loop or recursion in your sublime text as the pc may stop working which is not afforadable during a live contest
Use a different editor, like Dev C++ and are you on Windows or Linux?
Because in my case it just gives an error and force closes the executable file
I am posting a video about using sublime text for cp in 10 minutes.
very well explained bro, thank you !
whhy at prefix sum there is +10 in forloop??
great explanation!!!
Thank you bro for the good explanation
Bro in second last for loop you have used 2*k+10 but I think it should2*k+1
Yeah usually I do it for safety during the contest.
@@takeUforward what kind of safety bro, i think 2*k+1 will work fine for every testcase.
Nice Explanation!!
Nice explanation :)
Nice explanation brother :)
🎶🎶 kitni dafaa striver tune mera kaam aasan kia hai 🎶🎶
Great Explanation Bro..Thank you very much for this link of video highlighted in Codeforce's comment section....
Thanks, please leave a comment in the CF section if possible, helps people to know that this a genuine link.
Best video editorials in the west
How you've chosen only 3 values of x?
I've got it. Thanks for your tutorial .
love you brother...nicely explained...
awesome video! thank you so much
Can you add explanation for problem F? Thanks.
Yeah once I am free, am really buzy with my internship, hence I do post videos during the night only.
@@takeUforward No problem, I finally understood the solution and was able to code it on my own. Thanks for your help.
Discord link?
thanks a for great explanation
someone please explain what is for0()
good job man...thanks
really helpful video
Thanks, a lot bro you are the best
Really loved the explanation !! I am on 1500 right now, can you guide me on how to improve?
Same
Very didactic. Thanks!
I wanted to be expert this contest, but instead got a negative 50 delta. Please tell me how I can improve my speed coding abilities. I took 30 minutes to code only problem C!
WOw really really nice explanation brother :)
This will not work for the test case
1
4 2
1 2 1 2
map=[0, 2, 2, 2]
hash={3:2}
This is the code i wrote, i may be wrong too, please correct me
t=int(input())
for _ in range(t):
n,b=map(int,input().split())
arr=list(map(int,input().split()))
ans=float("inf")
m={}
pairs=int(n/2)
ind=[0]*((2*b)+1)
for i in range(1,int(n/2)+1):
if arr[i-1]+arr[-i] in m:
m[arr[i-1]+arr[-i]]+=1
else:
m[arr[i-1]+arr[-i]]=1
for i in range(1,int(n/2)+1):
ind[min(arr[i-1],arr[-i])+1]+=1
if max(arr[i-1],arr[-i])+b+1
This works bro, the answer is 0, which the code gives. If you take x = 3, so 0 changes are 2 pairs, 1 changes are 0 pairs, 2 changes are 0, hence total pairs left to be changed is 0, hence count is 0*2 = 0 changes.
@@j.shreyansh am really bad at debugging a code of a language am not familiar to. I have the code link in the description, please compare to it, by using print statements. Try putting print and check if your values and my code values are coming same or not. In this way you can figure it out.
Beautiful problem
Nailed it.
thanks, man!
nicely done
keep it up ... good one
2:00
Nice explanation. Thanks.
Glad it was helpful!
@@takeUforward obviously ❤
Great explanation Bhaiya.
Glad you liked it
Cool!!
Mera dimag kamjor hai ki ye question tough hai