Блог пользователя watchdogs132

Автор watchdogs132, история, 6 лет назад, По-английски

Link to problem :https://mirror.codeforces.com/contest/1034/problem/A

Link to my submission: https://mirror.codeforces.com/contest/1034/submission/46372547

My approach: I divided the vector of the numbers by their gcd. Then I tried to find largest subsequence having gcd greater than 1. To do that , I used the Sieve of Eratosthenes to calculate least prime factor of every number upto 1.5*10^7 and stored it in array Primes. In the factorise function , I just increase the count of divisors and then return the answer(n-count of the divisor that occurred maximum number of times).

My code gives wrong answer for test case #9. The different between jury's answer and mine is small though . Also I have read the editorial and my approach is same as that of the editorial . I think the problem is with the sieve maybe , should it be in linear time? . Thank you .

  • Проголосовать: нравится
  • -7
  • Проголосовать: не нравится

»
6 лет назад, # |
  Проголосовать: нравится -6 Проголосовать: не нравится
4
22 33 55 1

Your program outputs 3

»
6 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

If you know Bangla, then you can understand it from here. You can also use google translator.