Please read the new rule regarding the restriction on the use of AI tools. ×

woolgatherer's blog

By woolgatherer, history, 21 month(s) ago, In English

Will you guys help me finding the reason of getting idleness limit exceeded, i though flushed the output but still getting this verdict. I hope you don't need to go through the whole problem, watching the code may be enough. My Submission

Full text and comments »

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

By woolgatherer, history, 2 years ago, In English

Here in this problem problem it is said that for n jobs, given is the base price p for each job and an extra charge s for every pair of jobs (i, j), meaning that you have to pay additional s for job i, if and only if job j was completed before, you are to compute the minimum total costs needed to finish all jobs. constraint: 1 <= tc <= 100, 1 <= n <= 14 and base price 1 <= p <= 100000. I noticed some people solved it in O(2^n * n^2) using bitmask dp. As n is 14 so the complexity is approximately 321426400(> 1e8) considering 100 tc as well. How come it passes in 1 sec? An AC Code

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By woolgatherer, history, 3 years ago, In English

Recently I faced this problem in some greedy tags. But unfortunately even after several trials, I couldn't come up with a solution. The problem in brief is, You have to distribute some refugees into n counties or groups, each of the county has a limit Ci on number of refugee it can hold. The sum of all Ci is the total number of refugees that we have. your first target is to partition the population into n groups such that each group can be sent to the corresponding county that is C[i] matched with some group. You decided to do the grouping in multiple steps. Assume that initially, there is a single group of people. In each step, you can take any group of refugees with a total population of p and divide them into at mostk(k will be given) groups with an arbitrary number of people in each of the k groups. As you have to talk to all the people you are grouping, the cost of doing this operation is p. At any step, the refugees are not allowed to regroup again. So, you want to group the refugees following the above strategy with minimized cost. Please click on the above link to understand the problem better. Is this problem really a greedy one? If yes, then please explain the choice that we can make to get the optimal answer. If it is not, then also explain some other approach for this problem. I will be grateful to your effort for explaining this.

Full text and comments »

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

By woolgatherer, history, 3 years ago, In English

I will be grateful if anyone provide me the idea to solve the following problem. The problem says, we have five digits a, b, c, d, e (0 <= a, b, c, d, e <= 9). Now for these five digits, we can convert each of 120 permutations(5!=120) of these five digits into a decimal number. if the sum of all the 120 numbers is x, then we can exclude a number N from the sum which results in a sum of 119 numbers. Now we will be given that sum of 119 numbers, we have to find the numbers N that we excluded. if multiple answers possible output them all in ascending order. Note : the initial five numbers will not be provided. Problem Link

Full text and comments »

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