Something fishy with MXMLCM test case

I have recently tried to solve the MXMLCM Problem from LTIME
https://www.codechef.com/LTIME82

here is the problem link

I have found something fishy with the test case for MXMLCM

here’s how

take this code
https://www.codechef.com/viewsolution/30842253
this code gets 100 points

while take my code
https://www.codechef.com/viewsolution/30842277

which gets wrong answer on 3 test cases and right on last test case

now run both the code with following input

1
6 9
1 9 4 4 1 4

my code gives 7

while the accepted user code gives 9

I think 7 will be the correct answer
cause with 7 the lcm is 252
while with 9 it is 36

so tell me how is my code wrong and the former code got accepted

P.S I have nothing against the author whose code i mentioned that got accepted

I just happen to see his solution with full marks first than anyone else’s solution

1 Like

Actually both solutions seems incorrect.
He was lucky to get AC. Its because they might have removed some test files as mentioned in announcement section.

2 Likes

why is my solution in correct. can u please point it out

https://www.codechef.com/viewsolution/30842253
this is not right,
because he not considering the factor > sqrt(N)

1 Like

yeah but he still gets AC

nonetheless i ma more interested in why my solution is not passing

Will try to find the bug tomorrow. Mention me if no one replies and I forget to answer.

I figured it out

it was where i updated dictionary

2 Likes

YES, YOU ARE INITILIZING THE DICTIONARY EVERY TIME THAT END UP HAVING ONLY THE ELEMENT ITSELF AS ITS FACTOR