DISTINCT PAIRS

Pages: 12
Jan 8, 2019 at 6:51pm
i am able to do it in O(n) complexity still 25 points :(
Last edited on Jan 8, 2019 at 8:50pm
Jan 8, 2019 at 7:41pm
if you are doing it in O(n) then you cannot be getting tle.
and if you are getting wa then your logic is wrong.
P.S: please edit your comment as it is giving away a major hint to everyone.
Jan 8, 2019 at 8:21pm
@ks692 Oh. Then I have probably solved this question using a different logic since I didn't care for any specific value in either of the arrays.
Jan 9, 2019 at 5:46pm
@ks692 you could think of two pointer approach ...
Jan 10, 2019 at 9:40am
my code does not check for the elements present explicitly ,like it does (IYKWIM) but yeah so the problem is that my code fails the 11th case alone and i am not able to figure it out for the past 2 days and rest of the cases are AC.
And yes it is WA for the 11th test case alone .
Pls help!!
Jan 10, 2019 at 8:21pm
atlast got it!!.
if anyone else is facing the same prob read the constraints again it says |Ai|<=10^9.
Jan 11, 2019 at 5:51pm
Hey @LordRiddle Can you explain the meaning of line (A1,A2,....An are pairwise distinct )in Constraints?
Jan 12, 2019 at 7:16pm
closed account (10fNAqkS)
I cant get any hint ,Please somebody help me

LordRiddle what are you trying to say plz understand me
Last edited on Jan 12, 2019 at 7:21pm
Jan 13, 2019 at 7:26am
see the thing that they are pairwise distint is that they are "unique".
and u are asked to print n+m-1 pairs .
These two are the major hints that is required to solve the problem explaning further more u dont need to put the sum and check for them theres another way where u dont need to compute the sum at all.
I guess i have revealed the max .
Try again i was struggling with this but it is a cakewalk trust me.
cheers:).
Topic archived. No new replies allowed.
Pages: 12