E constraints were too tight. This complexity N*M is not expected for E.
@AppMaruf14 сағат бұрын
Can u explain why we will use c++ 20? in A
@pr_inv819 сағат бұрын
can u explain this in case of k = 10 ^ 18 its answer = 1000000001000000000 why not its 1000000000099999999??
@GauravDuseja-t6q21 сағат бұрын
How base case for len=1,k is 1 for 0,k suppose [0,3]-->[3,3],[2,3],[4,3] there are 3 possibility coming
@moopoo-h2u23 сағат бұрын
When Update problem F my bro, i really wanna solve that
@danielhack096Күн бұрын
w
@danielhack096Күн бұрын
g
@harshalgupta3453Күн бұрын
The algorithm for problem B is is giving wrong answer on 8 th test case in java: import java.util.*; public class State{ public static void main(String args[]) { Scanner scm=new Scanner(System.in); int t=scm.nextInt(); for(int a=1;a<=t;a++) { long k=scm.nextLong(); long low=1; long high=(long)4e18; long mid=0; if(k==1) { System.out.println(2); } else { long answer=0; while(low<=high) { mid=(low+high)/2; long ans=mid-(long)Math.floor(Math.sqrt(mid)); if(ans<k) { low=mid+1; } else { answer=mid; high=mid-1; } } System.out.println(answer); } } } } Can someone suggest why?
@colgate1602Күн бұрын
I am a c++ user but from I guess I think your Math.sqrt() function takes double for input, but you need long double for input, so you should use binary search for taking out the sqrt or check out if there is a function in java that takes long double for input. Similar thing happened to me where my sqrt() function didn't worked, so I had to use sqrtl() which is new to me
@harshalgupta345311 сағат бұрын
@@colgate1602 thanks buddy !!
@aditisingh-i8oКүн бұрын
Using dfs on graphs in D gives MLE on test case 7
@gaurishbaliga3723Күн бұрын
You need to optimise adding edges. Like in my solution code, if you replace DSU.unionset by the push_back we do for graphs, it should work
@VasuBhalaniКүн бұрын
please help me same code in c++ why not run in java. import java.util.Scanner; public class problema { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- != 0) { long k = sc.nextLong(); long maxans = (4 * (long) Math.pow(10, 18)) ; long low = 1L; long high = maxans; long myans = 0L; while (low <= high) { long mid = ( low) + ((high-low) / 2); double ans = Math.sqrt(mid); long my = (mid - (long)ans); if (my < k) { low = mid + 1; } else { myans = mid; high = mid - 1; } } System.out.println(myans); } sc.close(); } } please help me give wrong answer in java same code. why giving wrong answer in testcases 8 .
@lakshaydhiman4056Күн бұрын
Nice explanation sir, i have never solved problems on probability and modular inverse. Solution was a great help
@ishanmusic677Күн бұрын
use long long and submit in c++20 (if anyone getting tle)
@AppMaruf14 сағат бұрын
Can u explain why we will use c++ 20?
@ishanmusic67714 сағат бұрын
@@AppMaruf im not sure but ig c++20 comes up with some optimization in stl and better run time behaviour, so due to that the same solution got accepted which is giving tle in c++17
@mahedihasananik2542 күн бұрын
Why we are still looking for mid in the else statement after setting answer equal to mid? In the else statement why we are still doing r=mid-1 after setting the answer equal to mid? In the problem B.
@rounakpatra3406Күн бұрын
Because we have to minimize our n There can be multiple n for which exactly k bulbs will light up and we have to choose the minimum no of bulbs hence once we get an possible n we are storing it in answer and looking for smaller n to check wether can we achieve the desired state of exactly k bulbs that are on
@weeblyoverloaded3824Күн бұрын
we want to find the minimum answer, when our on > n that means we have a value which can be our answer but as we want the minimum value we will look on left side to find the least value
@Aryan_0832 күн бұрын
problem A is giving tle in test 3 in java
@skipper_and19 сағат бұрын
yes, check codeforces editorials they do upload the codes.
@Artisto-E72 күн бұрын
I just copy and paste your code(problem A). But it's getting TLE in 5th test case ?
@aniketgupta89032 күн бұрын
Yea, It's TLE, they are expecting O(n)
@GopalYadav-re5rmКүн бұрын
Try submitting in c++ 20 it will work
@AppMaruf14 сағат бұрын
@@GopalYadav-re5rm Can u explain why we will use c++ 20?
@viratjain83942 күн бұрын
what kind of question is b i mean similar question names?
@Aryan-lk5lh2 күн бұрын
I already did 2nd queation within 1 hour but showed wrong on test case 8 even when it was completely right because of the reason that i was using C++ 20 compiler instead of C++17 🥲🥲🥲🥲🥲
@AppMaruf2 күн бұрын
Can u explain the time complexity of A?
@balasubramania32802 күн бұрын
Hey can you please add time stamps for A, B , C, D, E so that we navigate easily
@MikasaAckerman-v8o2 күн бұрын
Very great explanation
@GopalYadav-re5rm2 күн бұрын
The first code is now giving tle on 5th test case UPDATE: Sorry guys I was submitting In c++ 17 which is getting tle whereas c++20 It is getting accepted no idea why
@tervicke4872 күн бұрын
i used similiar approach and got accepted , u might be be going wrong somewhere with the loop causing an infinite loop.
@mahadevpnair31962 күн бұрын
@@tervicke487 Can you share your code? I am getting TLE on 5th too.
@gaurishbaliga37232 күн бұрын
Its probably because I have defined int as long long in my code and you haven’t causing an integer overflow
@mahadevpnair31962 күн бұрын
@@gaurishbaliga3723 It's Time Limit Exception, not any other kind of error.
@gaurishbaliga37232 күн бұрын
@@mahadevpnair3196Do share your code, let me look into it
@frouMagician2 күн бұрын
your explanations are crisp and to the point! Love it
@Vegito-ew3gn2 күн бұрын
Gaurish sir is lit🔥🔥
@MindMingle-x3j2 күн бұрын
hey ,where to practice mathematical question like 1st or 2nd one.
@ubabnameh2 күн бұрын
past div 2 a,b questions
@sahil___jakhar2 күн бұрын
IQ + previous mathematics Olympiad exp
@sujansinhthakor2314Күн бұрын
search project euler hackerRank
@youtuberbro4258Күн бұрын
Atcoder beginner contests
@universalcosmologist36752 күн бұрын
it should be e1>=e2 for third problem as e1 is smallest endpoint greater than k and e2 is largest but less than k
@TLE_Eliminators2 күн бұрын
Please fill the feedback form for PCD: forms.gle/TamiaQyjCaXYobzP7
@vivek.tiwary2 күн бұрын
Hey Priyansh, this series is amazing, could you add more here ? If possible could you cover leetcodes problems ?
@Abhay142 күн бұрын
A- this give me TLE class Solution { public: string reverseNext(string temp){ string ans = ""; for(auto it : temp){ ans += ((it-'a' + 1) % 26) + 'a'; } return ans; } char kthCharacter(int k) { string word = "a"; for(int i=0; i<k; i++){ string temp = word; word += reverseNext(temp); } return word[k-1]; } }; first time got TLE in easy solution :)
@itzzRaghav2 күн бұрын
Your for loop inside kthCharacter() method has k iterations, and the size of word will double in each iteration. So if k is 30, then the size of the string word will become 2^30 which we can't store in a string. And k can be as large as 500, so this solution wouldn't work.
@TLE_Eliminators3 күн бұрын
Please fill the feedback form for PCD: forms.gle/htwvkSfiCyv62Lfn8
@nomanbinsafar31283 күн бұрын
such a good explanation for B!
@subhajyotisaha10203 күн бұрын
One can also use TRie for the prolem A.
@garv12023 күн бұрын
6:30 bro be like , chalega kse nahi , le submission p submission 😂😂
@sujansinhthakor23143 күн бұрын
explanation of task b was so clear
@rahulg19893 күн бұрын
Thankyou bhai Love your content, currently 600 rating, road to CM
@priyanshvatsal97913 күн бұрын
Problem C's solution is as good as it can be 😇 Step1 - Find solution range ( Best -- n , Worst -- 1 ) ( Height of decks ) Step2 - Iteration through range from best to worst - Construct the deck ( total_cards_in_all_decks, no_of_decks ) - Check its validity ( total_cards_in_all_decks >= minimum_cards_available && max_frequency_any_card_type <= no_of_decks ) - If valid, return
@pawanjindal75884 күн бұрын
why we have freq1[word1[0]-'a']++; as we have initialised s and e from 0?
@Rlxn54 күн бұрын
Good explanation for B ❤
@11aniketkumar4 күн бұрын
Problem B explanation was great! I didn't found anyone explaining so clearly except this video
@swadheen013 күн бұрын
yes, i am also here for this one. and it is well explained.
@viratjain83942 күн бұрын
what kind of question is b i mean similar question names?
@11aniketkumar2 күн бұрын
Maybe combinatorics because i starting points and (n-i) ending points needs to be multiplied is a concept of combination and permutations. Try problems with terms like subset, subarray or subsequence.
@viratjain8394Күн бұрын
@@11aniketkumar thank you bhai!! i will try to find out similar question
@NANUVALAADITHYA4 күн бұрын
Can u tell the date when TLE 12.0 will be open?
@yatharthgupta64684 күн бұрын
can you explain why doesn't binary search works in c? I correctly implemented the check conditions however since i did by bs,i failed in later test cases
@pranavsuren948910 сағат бұрын
Same
@shashanktiwari69994 күн бұрын
was contest difficult today or its me only who is feeling this😅
@ThePROestRedn994 күн бұрын
It seemed difficult
@mradultiwari98644 күн бұрын
It is
@shashankvashishtha44544 күн бұрын
B's problem statement is extremely difficult for me to understand (very unclear)
@ThePROestRedn994 күн бұрын
@@shashankvashishtha4454 fr ..... That's because of Ai ..... But still chat gpt was able to solve it in first try i checked
@shashankvashishtha44544 күн бұрын
@@ThePROestRedn99 seriously 😳
@TLE_Eliminators4 күн бұрын
Please fill the Feedback form for PCD: forms.gle/PMkxPXD9KoRd5vJr5
@satheeshbhukya99704 күн бұрын
Nice explanation sir
@tuighetmonsinh78694 күн бұрын
thank you so much!
@PubgMerabeta5 күн бұрын
In your C solution you also get WA just bcz of not taking letter in a variable name temp . But I don't understand why. Can you please tell why?
@ashutoshraj71715 күн бұрын
D -> solution ( passed -with out tle ) void sol() { int n; cin>>n; int ans=0; vector<int>arr(n); for(auto &it:arr) cin>>it; vector<int>str(1<<20,0); for(int i=0;i<n;++i) { for(int j=i+1;j<n;++j) { str[arr[i]^arr[j]]++; } } for(auto &it:str) { if(it>1) { ans+=(it*(it-1)); } } cout<<4*ans<<" "; }