Блог пользователя Igor.Ivanich

Автор Igor.Ivanich, 14 лет назад, По-английски

Hi everyone,

The problem which I've been stuck on is: http://cs.stanford.edu/group/acm/slpclive/problems/G.pdf

Can someone please give me some hints / idea how to solve this problem?

Cheers

Полный текст и комментарии »

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

Автор Igor.Ivanich, 15 лет назад, По-английски

Hi everyone,

Well the problem which I'm going to discuss here is from USACO Chapter 3.

The problem description is given below:

For a given set of K prime numbers S = {p1, p2, ..., pK}, consider the set of all numbers whose prime factors are a subset of S. This set contains, for example, p1, p1p2, p1p1, and p1p2p3 (among others). This is the set of `humble numbers' for the input set S. Note: The number 1 is explicitly declared not to be a humble number.

Your job is to find the Nth humble number for a given set S. Long integers (signed 32-bit) will be adequate for all solutions.

K and N, 1 <= K <=100 and 1 <= N <= 100,000.

 I'm getting TLE due to running O(N ^ 2 * K) algorithm (Simply I'm building the humble number sequence
starting at 1 then at each iteration find the minimum number which is bigger than the last found humble number).

Am i missing something? Or is there a better algorithm for solving this problem?


Thanks in advance.


Igor.

Полный текст и комментарии »

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

Автор Igor.Ivanich, 15 лет назад, По-английски
Hi Everyone,

Please give me some hints about this problem:
http://online-judge.uva.es/p/v100/10032.html


I've been stuck on it for a week but getting TLE,
the DP state of my program is:

dp(total_weight, current_index, remaining person) = min(dp(tot_weight - v[i], current_index + 1, remaining person - 1), dp(tot_weight, current_index + 1, remaining));


As I said my solution gets TLE. because of huge size of my memoization array.


Thanks in Advance.


Полный текст и комментарии »

Теги dp, uva
  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится

Автор Igor.Ivanich, 15 лет назад, По-английски


Hi everyone,

I'm new to Codeforces, Seems a very nice place for training.
BTW, I'm trying to solve this problem
http://acm.sgu.ru/problem.php?contest=0&problem=122
I've search for the Dirac's Theorm which states that there is a hamiltonian cycle.
But how should I build the path?


Cheers


Igor

Полный текст и комментарии »

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