Storm_Stark's blog

By Storm_Stark, history, 5 years ago, In English

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?

Full text and comments »

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

By Storm_Stark, history, 5 years ago, In English

Full text and comments »

  • Vote: I like it
  • -17
  • Vote: I do not like it