Google code Kickstart 2019 (Round E)

Правка en1, от Storm_Stark, 2019-08-25 14:35:32

Cherries Mesh:

Logic:

use Kruskal to find mst of different components, then suppose there are K component then we require k-1 connection of 2 to connect them. answer=sum of mst of min wt of diff component+(k-1)*2;

code:

https://shashankmishracoder.wordpress.com/2019/08/25/125/

Street Checkers

logic:

  1. number =2^p1*3^p2*5^p3......... 1.total number of factors=(p1+1)*(p2+1)*....
  2. total odd factors(X)=(p2+1)*()...
  3. total even factor=(p1+1)X-X=p1*X;
  4. diff=(p1-1)*X;
  5. if p1=0 -x>=-2 so 1 or prime number
  6. if p1=1 diff=0
  7. if p1=2 X<=2 so 4 or prime
  8. if p1=3 then only 8 is possible
  9. calculate if number is prime from L to R(using segmented sieve) the use above conditions.

    code:

    https://shashankmishracoder.wordpress.com/2019/08/25/google-kickstart-2019round-e-street-checkers/

I was unable to solve B I took C/E ratio and proceeded with greedy implementation but was getting the wrong answer.

Can anyone help?

Теги kickstart, google, 2019, round e

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский Storm_Stark 2019-08-25 14:35:32 1082 Initial revision (published)