Upgrading.....'s blog

By Upgrading....., history, 5 years ago, In English

UVA 11762

Suppose we want to calculate E(N) where N is a number,k is the number of it’s distinct prime factors and p is the number of primes < n

Normal rule, E(N)=(1/p)*(1 + E(N/a1) + E(N/a2) + E(N/a3) … + E(N/ak)) + ((p-k)/p)*(1 + E(N))

What is the wrong about this logic?

Full text and comments »

By Upgrading....., history, 6 years ago, In English

You have an empty set. You have to support Q queries in the form —

1 X: Insert an element X in the set. It is guaranteed that X isn't already present in the set.

2 X: Delete an element X from the set. It is guaranteed that X is present in the set.

3 Y: Find and print sum of maximum Y elements in the set. If there are less than Y elements in the set, you need to print sum of all elements.

What is the best way to solve this problem? X<=10^9, Q<=10^5 Y<=10^5

Full text and comments »

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