lixolas's blog

By lixolas, history, 11 months ago, In English,

Hello everyone,

on last CodeForces, the problem A of Div1 Contest (this problem) was about some GCD operations. My solution (by the way, totally overkill, despite the fact that some people may have used the same idea) used binary search and some prefix sum matrix (for checking if GCD on range equals 1), only considering primes smaller than 40,050. Although it is getting AC (my solution during the contest, translated to english), I figured out a case where it fails:


524287 524287

(actually, it could be any prime numbers greater than 40,050.)

In this case the solution is -1 (because the gcd of two equal numbers is the number itself), however, my code prints 1 as the answer. Is there anything that can be done about this?

  • Vote: I like it  
  • +19
  • Vote: I do not like it  

11 months ago, # |
  Vote: I like it +5 Vote: I do not like it

If I recall correctly, test cases can be added to existing problems. Accepted solutions will not be rejudged though.

  • »
    11 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    It would be nice to add some test cases like this one =)