DISTINCT PAIRS

Pages: 12
i am able to do it in O(n) complexity still 25 points :(
Last edited on
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.
@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.
@ks692 you could think of two pointer approach ...
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!!
atlast got it!!.
if anyone else is facing the same prob read the constraints again it says |Ai|<=10^9.
Hey @LordRiddle Can you explain the meaning of line (A1,A2,....An are pairwise distinct )in Constraints?
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
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:).
Registered users can post here. Sign in or register to post.
Pages: 12