I dont know if my comment is relevant to this video or not, but during the contest I was not able to think any approach for B, so I moved to C, the logic seemed very simple, I started to solve, ran my code on TCs and got matching outputs for the case where order was alice bob and charlie, so i figured I should make all the cases, but didn't do it as I thought writing every case may give error on systems tests,so I left. Today I wanted to upsolve this I gave it some time, took help from your solution and the thing was to code it now. I adopted a different approach from this solution for my code, after 2 hours, 2 wrong answers and 1 compilation error, it finally got accepted. Very trivial thing, but feels amazing, maybe this is the thrill of CP everyone talks about :)
@priyanshkumar_iitdАй бұрын
Great bro
@ritabratapal8489Ай бұрын
For C IT CAN BE DONE BY TAKING ALL THE 6 PERMUTATIONS ALSO
@zebra-er6xcАй бұрын
can you share the code, I got TLE on testcase 3 in the contest while considering this
@ritabratapal8489Ай бұрын
@@zebra-er6xc sure bro #include #define lli long long int #define vi vector #define vpi vector #define pb push_back #define endl " " #define vli vector #define rep(i,s,n) for(int i=s;i>i #define out(a) for(auto i:a)cout
@ritabratapal8489Ай бұрын
u basically check for all the 3!=6 combinations if u still dont get the answer then print -1
@ayushbhowate42Ай бұрын
I did the same thing
@AyushVerma-ui7reАй бұрын
First question took me like 15 minutes to get the intuition in the contest.
@priyanshkumar_iitdАй бұрын
Yeah. I also took 8 minutes
@adarshamit7860Ай бұрын
took me 6-7 min to see ki koi aur aisa test case pr khela na ho jaaye XD
@AyushVerma-ui7reАй бұрын
The example test case solutions were too confusing to get the intuition directly 😂.
@priyanshkumar_iitdАй бұрын
@@AyushVerma-ui7re Yeah, you're right. They were confusing
@adarshamit7860Ай бұрын
I m from patna😂 and ik they do these kind of stuff intentionally😂😅😂
@studyplanet4656Ай бұрын
Gaurish , thanks buddy I got the intuition for problem D .
@vanshrana7807Ай бұрын
Just loved your explanation specially for problem D ❤
@swaggyxo7488Ай бұрын
Bro the date and time on ur device tripped me tf out 💀🥴 Edit: Amazing explanation of D. I was on to the third observation right from the start but didn't fully understand it, thanks to you, now I can. The inversion concept really tickled my brain, makes me want to start with the hard sections of the A to Z Striver's DSA sheet which I left for later. It has the count inversions question too.
@ankit21309Ай бұрын
For D : first sort the first array and make the same index changes in the second as well Do it for the second array, if the count of operation if odd in the second array operations then the and is no other wise the answer is yes, also make sure the element in both the array are same
@AmrutanshuMishra-dp1mfАй бұрын
Amazing explanation!!!
@user-sw3oo9fr5lАй бұрын
In B, does the order of choosing sub-rectangles matter?
@aye_man_07Ай бұрын
In B it is much easier than that...although it took me almost an hour to figure that out so just create a grid of what changes you need to make in each of the cells and then simply run two diiferent loops over the grid. in one loop calculate the sum of each row and if any one is not divisble by 3 just print NO similary do it for all the columns and in the end if all are divisble just print YES.
@EntertainmentexeАй бұрын
Can you give the intuition?
@EvenHeisenbergIsCertainAboutMeАй бұрын
i did same during the contest still got wrong on testcase 2, maybe some minor mistake i think i had to revisit cf
@harshpandey4190Ай бұрын
@@EvenHeisenbergIsCertainAboutMe remove abs from your ans
@jayasuryanalamolu3305Ай бұрын
@@Entertainmentexe@Entertainmentexe Basically, on every operation, we add 3(1,2) to that operated row and column, so the difference in the initial and final sum for every row and column must be a multiple of 3; if not, the final matrix cannot be achieved.
@sahilrao4592Ай бұрын
best explanation sir !!
@prathameshbhangre3147Ай бұрын
Great explanation
@pargatsingh2369Ай бұрын
Gaurish Bhaiya 💯
@prathameshbhangre3147Ай бұрын
explanation is very beginner friendly
@mohammadgaus7Ай бұрын
Maybe am soo dumb that am still confused what you did in first question, like how...
@troys1426Ай бұрын
How I did first question is basically: We can think of any array that satisfies it. The idea is that the sum of the multiples of k *are* divisible by k. Hence, if you output the numbers from 1 to N for Problem A, you realize that you are essentially summing up all multiples of k from 1 to N.
@priyanshkumar_iitdАй бұрын
If you dry run the test cases, then you'll get the intuition. I also did this during the contest.
@shubham_jhaАй бұрын
Realisation 👍
@priyanshusingh3208Ай бұрын
For problem B at 25:40 can't i take the whole grid as a subrectangle an just change the diagonal elements as required ? why do smaller subrectangle and complicate things?
@AyushVerma-ui7reАй бұрын
@@priyanshusingh3208 because he was trying to explain that every rectangle operation can be broken into multiple 2X2 square operations thus reducing the complexity of the question. You can just think it in a much simpler way.
@adii16089Ай бұрын
Thank you sir..
@aniket6817Ай бұрын
🙏
@SinchlandАй бұрын
IICPC ❤
@siddheshpandey7905Ай бұрын
How to think about the solution of second question?
@akashsonar6332Ай бұрын
I like how he🫡 explained the Q2 problem, about how the AUTHOR would have want us to do..