Problem Link: 439C - Devu and Partitioning of the Array
My Latest Submission: 110975767
My approach: Create first (k - p)
parts using a single odd element in each of them. For the next p
parts, treat the first (p - 1)
parts separately using odd elements in pairs first, and if we run out of odd elements, use a single even element afterwards. For the last part, display everything that's left.
PS: I know CF blogs aren't the best place for query resolution but it's the only one I've got!
test case: 3 2 0 1 2 3 your output: 1 1 1 3 1 2 (you have 3 parts instead of 2)