You are not logged in. Please login at to post your questions!


FEB19 HMAPPY2 Wrong Logic Gives AC (100/100) !!

1.Wrong Logic Without LCM Still 100/100 !!

2.Right Logic With LCM 100/100 !!

This Solution contains wrong logic still it gives 100/100

This Solution only gives perfect answer when they give input A & B as the LCM(A,B) is A or B only.else it's wrong u can check that.

The Hidden test case files only contains that input in which LCM(A,B) is A or B.. so Test Cases are not considering all conditions..

Even The Example Test case is not in that test case file !! Because this solution gives wrong answer in that example test case also !!! still it gives AC(100/100) !!!!

asked 13 Feb, 21:47

mj_13's gravatar image

accept rate: 0%

edited 13 Feb, 22:48

Yeah it's observable
6 2 3 3 then 6/2=3 and 6/3=2 , lcm(2,3)=6 therefore 6/6=1 and 2*1=2 so final solution is 3+2-2=3 and 3>=3 hence 'Win'

according to your logic:- 6/2=3 and 6/3=2 then |3-2|=1 and 1<3 hence it's 'Lose then this should be a wrong answer.


answered 13 Feb, 22:17

mann2108's gravatar image

accept rate: 100%

edited 13 Feb, 22:29

yeah you are right the hidden test cases only have LCM(a,b) == a or b

that's why his solution worked

I think that ideal solution should be after considering the LCM of a,b

see these two solutions of mine :

  1. wrong answer when I didn't consider LCM

  2. AC when LCM is considered


answered 13 Feb, 22:32

himalaya7's gravatar image

accept rate: 9%

edited 13 Feb, 22:40

Seems like question has weak test cases. The accepted solution without LCM should be WA.


answered 14 Feb, 02:21

vichitr's gravatar image

accept rate: 11%

edited 14 Feb, 02:21

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 13 Feb, 21:47

question was seen: 504 times

last updated: 14 Feb, 02:21