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

Автор Xsquare, 10 лет назад, По-английски

http://codeforces.me/gym/100494/attachments

Here is the link of the contest problems, I want to discuss problem F here. People have made very few submissions for this problem, may be just because its difficult to catch the greedy part here.

Anyways, never mind. I gave it a try like everyone else did and thought of a backtrack solution. http://ideone.com/8h8X4v (This is the link for my code).

I dont know how to mantain a state here.

The only state I can think of is F(t,mask,vector spent) where t denotes time elapsed till now, mask denotes which all bugs have been fixed (set bits for the fixed bugs) and vector spent would denote an array which would keep the count as in how much time, we have wasted on ith problem.

But, seems the problem can be solved by keeping a different state. Instead of vector spent, they say, you can just keep an overall time elapsed on fixing all the unfixed bugs, why is it so!

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

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

this code can get TL, but I hope the main idea is clear.