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 :)
@priyanshkumar17
2 ай бұрын
Great bro
@ritabratapal8489
2 ай бұрын
For C IT CAN BE DONE BY TAKING ALL THE 6 PERMUTATIONS ALSO
@zebra-er6xc
2 ай бұрын
can you share the code, I got TLE on testcase 3 in the contest while considering this
@ritabratapal8489
2 ай бұрын
@@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
2 ай бұрын
u basically check for all the 3!=6 combinations if u still dont get the answer then print -1
@ayushbhowate42
2 ай бұрын
I did the same thing
@AyushVerma-ui7re
2 ай бұрын
First question took me like 15 minutes to get the intuition in the contest.
@priyanshkumar17
2 ай бұрын
Yeah. I also took 8 minutes
@adarshamit7860
2 ай бұрын
took me 6-7 min to see ki koi aur aisa test case pr khela na ho jaaye XD
@AyushVerma-ui7re
2 ай бұрын
The example test case solutions were too confusing to get the intuition directly 😂.
@priyanshkumar17
2 ай бұрын
@@AyushVerma-ui7re Yeah, you're right. They were confusing
@adarshamit7860
2 ай бұрын
I m from patna😂 and ik they do these kind of stuff intentionally😂😅😂
@studyplanet4656
2 ай бұрын
Gaurish , thanks buddy I got the intuition for problem D .
@swaggyxo7488
2 ай бұрын
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.
@AmrutanshuMishra-dp1mf
2 ай бұрын
Amazing explanation!!!
@user-sw3oo9fr5l
Ай бұрын
In B, does the order of choosing sub-rectangles matter?
@vanshrana7807
2 ай бұрын
Just loved your explanation specially for problem D ❤
@pargatsingh2369
2 ай бұрын
Gaurish Bhaiya 💯
@sahilrao4592
2 ай бұрын
best explanation sir !!
@prathameshbhangre3147
2 ай бұрын
Great explanation
@ankit21309
2 ай бұрын
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
@aye_man_07
2 ай бұрын
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
2 ай бұрын
Can you give the intuition?
@EvenHeisenbergIsCertainAboutMe
2 ай бұрын
i did same during the contest still got wrong on testcase 2, maybe some minor mistake i think i had to revisit cf
@harshpandey4190
2 ай бұрын
@@EvenHeisenbergIsCertainAboutMe remove abs from your ans
@jayasuryanalamolu3305
2 ай бұрын
@@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.
@aniket6817
2 ай бұрын
🙏
@adii16089
2 ай бұрын
Thank you sir..
@mohammadgaus7
2 ай бұрын
Maybe am soo dumb that am still confused what you did in first question, like how...
@troys1426
2 ай бұрын
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.
@priyanshkumar17
2 ай бұрын
If you dry run the test cases, then you'll get the intuition. I also did this during the contest.
@shubham_jha
2 ай бұрын
Realisation 👍
@priyanshusingh3208
2 ай бұрын
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
2 ай бұрын
@@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.
@Sinchland
2 ай бұрын
IICPC ❤
@prathameshbhangre3147
2 ай бұрын
explanation is very beginner friendly
@siddheshpandey7905
2 ай бұрын
How to think about the solution of second question?
@factsbyawadheshgupta6961
10 күн бұрын
Might be late but best code for C as far as I think void solve() { cin>>n; vvi a(3, vi(n)); for (int i = 0; i < 3; ++i) { for (int j = 0; j < n; ++j) { cin>>a[i][j]; } } int tot = ceil(accumulate(all(a[0]), 0ll)/3.0); for(auto &v: perm) { int first = v[0], second = v[1], third = v[2]; int i = 0, sum = 0, x, y; while(i < n && sum < tot) sum += a[first][i], i++; sum = 0, x = i; while(i < n && sum < tot) sum += a[second][i], i++; sum = 0, y = i; while(i < n && sum < tot) sum += a[third][i], i++; if(sum >= tot) { vvi ans(3); ans[first] = {1, x}; ans[second] = {x+1, y}; ans[third] = {y+1, n}; for(auto u: ans) { cout
@akashsonar6332
2 ай бұрын
I like how he🫡 explained the Q2 problem, about how the AUTHOR would have want us to do..
Пікірлер: 44