Tree Cut Xor (Codechef Starters 154)
9:06
Пікірлер
@selvaragavan_10
@selvaragavan_10 4 күн бұрын
Bro thank you very much.!! Change your mic bro. You have a great potential !.
@mostafasazid
@mostafasazid 11 күн бұрын
Code link not work
@soumyabhattacharjee1051
@soumyabhattacharjee1051 10 күн бұрын
Oh sorry, I did not know we can not directly share code link cses.fi/paste/0b9bc0acd257b34ba44d32/ Updated it now
@AswinnathTE-f8j
@AswinnathTE-f8j 15 күн бұрын
my Trie solution ``` class TrieNode: def __init__(self): self.child={} self.count=0 class Trie: def __init__(self): self.root=TrieNode() def insert(self,word): dmy=self.root ans=0 for i in word: if i not in dmy.child: dmy.child[i]=TrieNode() else: ans+=dmy.child[i].count dmy=dmy.child[i] dmy.count+=1 return ans n=int(input()) arr=[i for i in input().split()] ans=0 Tree=Trie() for i in arr: ans+=Tree.insert(i) print(ans) ```
@NayanPahuja
@NayanPahuja 22 күн бұрын
Hey Man, Great Explanations. you are bound to go popular soon!. Keep up the good work
@soumyabhattacharjee1051
@soumyabhattacharjee1051 20 күн бұрын
Hello, thanks for the comment. Please subscribe to the channel if you have not already
@studyplanet4656
@studyplanet4656 23 күн бұрын
What would be the difficulty level of this question as compared to codeforces , any idea what would be its rating .
@soumyabhattacharjee1051
@soumyabhattacharjee1051 23 күн бұрын
I think it would be around 1700-1900(Div2 C/D). If you find this helpful, please like and subscribe
@studyplanet4656
@studyplanet4656 24 күн бұрын
Great explanation , I like the observation 👍👍
@soumyabhattacharjee1051
@soumyabhattacharjee1051 24 күн бұрын
Thank you, please subscribe
@surendrapokala5533
@surendrapokala5533 28 күн бұрын
I watched many videos for this problem but it is the short and more intutive, Thanks bro
@soumyabhattacharjee1051
@soumyabhattacharjee1051 28 күн бұрын
Thanks for the comment, please subscribe to the channel
@tempbot7190
@tempbot7190 Ай бұрын
Great Explanation! Please continue such explanation as main focus should be on intuition and approach rather than code
@sadharanInsaan122
@sadharanInsaan122 Ай бұрын
Excellent explanation.. Keep it up.. Make more editorials for upcoming contests
@soumyabhattacharjee1051
@soumyabhattacharjee1051 Ай бұрын
Thanks, please subscribe
@ITACHIUCHIHA-dr8sz
@ITACHIUCHIHA-dr8sz Ай бұрын
Your explanations are always crisp and sufficient, thanks a lot
@soumyabhattacharjee1051
@soumyabhattacharjee1051 Ай бұрын
Thanks, it means a lot
@dhruvkumarkakadiya410
@dhruvkumarkakadiya410 Ай бұрын
not understand anything at all!
@Code_Note
@Code_Note Ай бұрын
Thanks for this solution dada , during contest I got the idea of using mask but wasn't able to play with the mask correctly.
@kz_cbble9670
@kz_cbble9670 Ай бұрын
Saw you competing today after a long time.. Solved A-D and F
@Naman-n4b
@Naman-n4b 2 ай бұрын
Detto code but gives the now , they added so.e extra test cases
@TarunSantani
@TarunSantani 2 ай бұрын
Didn't understand the part of the pigeon hole principle. - how did you use it ? Can you explain it in somewhat easy way.
@soumyabhattacharjee1051
@soumyabhattacharjee1051 2 ай бұрын
Pigeon hole principle says that if there are N numbers and we are taking N+1 numbers then at least one number bound to get repeated. Similar concept here, let say if the N+M-1 cells are from the same row and same column of the current cell and we take N+M+1 max cells then we are going to find the max and second max excluding all the cells of the current cell's row and column If you find this helpful, please like and subscribe
@TarunSantani
@TarunSantani 2 ай бұрын
@@soumyabhattacharjee1051 ok thank you I will rewatch the video
@mohammadehson1585
@mohammadehson1585 2 ай бұрын
Bhai kya bawasir he ye solution bhi shi nhi he
@soumyabhattacharjee1051
@soumyabhattacharjee1051 2 ай бұрын
Give a case where its failing
@arshlanali5665
@arshlanali5665 2 ай бұрын
Great solution!
@mowafkmha4505
@mowafkmha4505 2 ай бұрын
nice approach of counting the number of segments which will have odd and even number of 1's . there is actually an easier approach which aryanc explained using the prefix xor but it might be a little hard to think about the prefix xor which will make the counting much more simpler
@therawringkitty
@therawringkitty 2 ай бұрын
Can you explain solution of problem G?
@adi4178
@adi4178 3 ай бұрын
You explain well, I recomand you to give us all approach from brute force to optimal, If you do it your chanal will grow because no one do this.
@soumyabhattacharjee1051
@soumyabhattacharjee1051 3 ай бұрын
Sure, will keep that in mind
@prajjawalsingh4952
@prajjawalsingh4952 3 ай бұрын
nice explanation 👍
@ouvik9509
@ouvik9509 3 ай бұрын
very helpful dada ❤
@kashishchawla2754
@kashishchawla2754 3 ай бұрын
d problem?
@soumyabhattacharjee1051
@soumyabhattacharjee1051 3 ай бұрын
D is kind of a simple breadth-first search, so have not covered it, you can check my solution atcoder.jp/contests/abc361/submissions/55280719 and ask me if there is any doubt
@kashishchawla2754
@kashishchawla2754 3 ай бұрын
@@soumyabhattacharjee1051 understood the approach, how can we be sure about the tc, can u pls elborate
@soumyabhattacharjee1051
@soumyabhattacharjee1051 3 ай бұрын
@@kashishchawla2754 The total number of states are at max O(N2^N) N for choosing the i where i and i+1 are spaces and 2^N for combinations of other. Now for each space the rearrangement is O(N) so overall complexity should not be more than O(N^2*2^N) Please like and subscribe if it is helpful
@kashishchawla2754
@kashishchawla2754 3 ай бұрын
thanks
@PubgMerabeta
@PubgMerabeta 3 ай бұрын
Bro can you explain C and D prb too?
@soumyabhattacharjee1051
@soumyabhattacharjee1051 3 ай бұрын
D is kind of a simple breadth-first search, so have not covered it, you can check my solution atcoder.jp/contests/abc361/submissions/55280719 and ask me if there is any doubt For C you can think about having a subsequence of N-K elements, so we can sort it and consider every subarray of size n-k. Here is my solution atcoder.jp/contests/abc361/submissions/55269760
@Jafar801
@Jafar801 3 ай бұрын
Your explanations are way better than @aryanc's. Thank you for making such good explanatory videos. Keep it up!
@darkknight98-v
@darkknight98-v 3 ай бұрын
thanks for such a simple and great explanation sir!
@furynick1620
@furynick1620 3 ай бұрын
Thank you sir. I learnt a lot from you.
@avijitbiswas3544
@avijitbiswas3544 4 ай бұрын
dp[i][1] = ( 1 + (n - 1) * (n - 1) ) * dp[i - 1] [1] can you explain why you are adding + 1 there. that part is already cover na?
@soumyabhattacharjee1051
@soumyabhattacharjee1051 4 ай бұрын
No (n-1)(n-1) is for choosing anything other than the current j, and 1 when getting (j,j) Please like, share and subscribe if it's helpful
@avijitbiswas3544
@avijitbiswas3544 4 ай бұрын
@@soumyabhattacharjee1051 subscribed sir
@angryman5517
@angryman5517 4 ай бұрын
Bro,can you help with B? I am trying to code it in python
@soumyabhattacharjee1051
@soumyabhattacharjee1051 4 ай бұрын
Try to contruct the string for every value of c and w Here is my python code for ref: atcoder.jp/contests/abc360/submissions/55056440 Please like and subscribe if it is hepful
@ITACHIUCHIHA-dr8sz
@ITACHIUCHIHA-dr8sz 4 ай бұрын
underrated channel, love these crisp explanations over those 40 to 60 minute long other video solutions
@soumyabhattacharjee1051
@soumyabhattacharjee1051 4 ай бұрын
Thank you so much for the appreciation, it means a lot. Hope you subscribed 😀
@amolmittal8895
@amolmittal8895 4 ай бұрын
great solution😊
@kz_cbble9670
@kz_cbble9670 4 ай бұрын
why did u stop codeforces?
@soumyabhattacharjee1051
@soumyabhattacharjee1051 4 ай бұрын
Generally cf contests are on weekdays and I do not get time to attend those. If there is some on weekend I can check those. As I am not regular and codeforces contests need grinding, I avoid participating rated. If there is something unrated like div3 in weekends I will definitely try to do it
@kz_cbble9670
@kz_cbble9670 4 ай бұрын
@@soumyabhattacharjee1051 Understandable.. bro has a job to keep
@blazerchicken1619
@blazerchicken1619 4 ай бұрын
Thank you, finally understood what the problem was trying to say
@soumyabhattacharjee1051
@soumyabhattacharjee1051 4 ай бұрын
Thanks for the appreciation, please subscribe if you have not already 😃
@Dhruv-fn8yr
@Dhruv-fn8yr 4 ай бұрын
provide solution for probem G
@shubhamtanwar7039
@shubhamtanwar7039 4 ай бұрын
great explaination
@shivamshrivastava5636
@shivamshrivastava5636 4 ай бұрын
Sir in case one of the values contains an odd number of elements, we have to ignore one of the elements. My intuition was to two create two cases: In the first case we will ignore the smallest element of the set and in the second case we will ignore the largest element of the set, we will take the minimum of the two cases in our answer. However, my approach is failing on some of the test cases.
@soumyabhattacharjee1051
@soumyabhattacharjee1051 4 ай бұрын
Consider the case 1 3 9 15 17 Here we have to ignore 9 which is neither max or min Please subscribe if you find this helpful
@FactsPolice
@FactsPolice 4 ай бұрын
Bro 23311's output is 19
@soumyabhattacharjee1051
@soumyabhattacharjee1051 4 ай бұрын
Sorry, did not get it. Can you elaborate?
@FactsPolice
@FactsPolice 4 ай бұрын
@@soumyabhattacharjee1051 look at the first test case's 7th number input and output
@manmeet704
@manmeet704 4 ай бұрын
Could u recommend some dp on bits questions
@thequacker6504
@thequacker6504 4 ай бұрын
this contest was more difficult than past contests
@soumyabhattacharjee1051
@soumyabhattacharjee1051 4 ай бұрын
Yes this C broke the flow of the contest, maybe easier C would be better
@The-fc1fi
@The-fc1fi 4 ай бұрын
Biweekly 4th question
@amimultamim9893
@amimultamim9893 4 ай бұрын
Thanks a lot!
@soumyabhattacharjee1051
@soumyabhattacharjee1051 4 ай бұрын
Please subscribe if you find this helpful!!
@sudhanshunain4690
@sudhanshunain4690 4 ай бұрын
thank u!! I thought the same idea but wasnt able to implement it. Can you also discuss 2 more approaches given in editorial, 1) By SCC and topological sort 2) Something related to depth of directed tree etc.
@code4111
@code4111 4 ай бұрын
Great explanation ❤️❤️
@Anonymous____________A721
@Anonymous____________A721 4 ай бұрын
Can we do rerooting instead of "in-out dp"
@helpingcoder1910
@helpingcoder1910 4 ай бұрын
👍
@kashishchawla2754
@kashishchawla2754 4 ай бұрын
g problem pls, thanks:)
@soumyabhattacharjee1051
@soumyabhattacharjee1051 4 ай бұрын
Its already there in the channel, please check. Thanks. Please subscribe
@darksidekiller5300
@darksidekiller5300 4 ай бұрын
amazing screencast Can you please explain the last question in detail? Thank you
@mayankshakya9200
@mayankshakya9200 4 ай бұрын
Bhaiya is there any way to connect with you?
@mayankshakya9200
@mayankshakya9200 4 ай бұрын
Except linkedin
@mayankshakya9200
@mayankshakya9200 4 ай бұрын
I wanna ask about cp
@soumyabhattacharjee1051
@soumyabhattacharjee1051 4 ай бұрын
Hey, lets connect on linkedin
@solvinglife6658
@solvinglife6658 4 ай бұрын
Cfbr