Comments

Yesssss!!!! I've been waiting for this >:D

On MonogonCodeforces Round #639, 6 years ago
-15

Please make the pretest as strong as you can (/ T — T )/ .

Woah editorial published very fast! Thanks FieryPhoenix for the contest <3

I've been waiting this for so long. GLHF!

EDIT:

For every weight, while it is available to put them in the packet 1, put 'em. else go to packet 2 and so on.

In case you don't understand the question: You can assume the problems like this,

  • Given N items with weight [1,K]

  • Given C1,C2,..,Ck which means the item with weight >= K in 1 packet must be at most Ck

  • The task is to separate the items so that the rules no.2 in fulfilled with the number of packets as minimum as possible

Test case 2:

6 10

5 8 1 10 8 7

6 6 4 4 3 2 2 2 1 1

N=6 K=10

Items = {1,5,8,8,7,10}

C = {6,6,4,4,3,2,2,2,1,1}

Answer:

You can separate the items into {10,8,1} and {8,5,7} or {10,7,5,1} and {8,8} or even {10,8,5,1} and {8,7}.

You can check my solution : https://codeforces.me/contest/1342/submission/78196440 (it's kind a mess tho)

In overall, my greedy solution goes with:

-Put the highest weight as the priority

-While it is available to put them in the packet 1, put 'em. else go to packet 2 and so on.