Help PPCG Claus Deliver his Presents
Overview
PPCG Claus is running hella late delivering his gifts because nowadays we have so many odd little kiddos out there. This makes it much harder for PPCG Claus to get all the presents to the correct place. Your challenge is to help him delvier his presents correctly.
The Complexity
Given a list of capitalized first names representing the kids he's supposed to deliver to and a list of presents represented by numbers, you must figure out how to distribute the presents among said children. Of course there's a catch though....
Nowadays kids are getting picky, if the kiddo is an odd fellow (first initial is ASCII-code odd) he wants an odd gift! If he's an even fellow (first initial is ASCII-code even) he obviously must be given an even one! Any child divisible by 3, however, is a naughty, naughty lad, so PPCG Claus must completely ignore them to make them behave next year. To consider his route a success he must deliver all presents to all children who deserve them and must not give any one child too many presents. If any child gets 3+ more presents than his or her peers, he risks becoming a naughty child next year, and that's just not right! Also, if any good child were to receive a present when another good child didn't, that also would turn that child evil.
Example
The kids are as follows:
Kids = ["Amy", "Betty", "Clyde", "Dave", "Francine"] = [A,B,C,D,F] = [65,66,67,68,70]
- Betty is the bane of humanity, clearly in cahoots with the number 3.
- Amy and Clyde have been weirdos since birth and would hate to receive even presents.
- Dave and Francine are normal, even, kids; they should only receive even presents!
The presents are as follows:
Presents = [1,2,3,4,5,6,7,8,9,10,11,12,13,14]
One possible output would be:
[
['Amy',[1,3,5]],
['Betty',[]],
['Clyde',[7,9,11,13]],
['Dave',[2,4,6,8]],
['Francine',[10,12,14]]
]
Exception Scenarios
However, just because PPCG Claus is ready and willing, doesn't mean PPCG Claus can. Here's a list of exception scenarios where you must break the bad news to PPCG Claus with a message of:
PPCGmas is cancelled!
The following scenarios will result in Christmas being cancelled:
- There are no children.
[],[1,2,3]
- Wellp, they ded.
- There are no good children.
["Betty"],[1,2,3]
- Seriously, screw Betty.
- There are no presents, or less presents than good children.
["Amy","Charles"],[]
- One or more would receive no presents.["Amy","Charles"],[1]
- One or more would receive no presents.
- There are not odd/even presents to satisfy all good children.
["Amy","Dave"],[2,4,6]
- Amy is screwed over.
Here's a list of scenarios that shouldn't affect PPCGmas:
- Leftover Presents (All children should receive the maximal amount of presents).
["Amy","Dave"],[2,4,6,8,10,12,14,7,9] = [["Amy",[7,9]],["Dave",[2,4,6,8]]]
Main Rules Reiterated
- Good children are either even or odd, based on their first initial.
- Bad children have a first initial wholly divisible by 3.
- All good children must receive at least one present.
- No good child is to receive greater than 2 presents more than any other good child.
- If there are to be leftover presents you must maximally distribute them, without violating 4.
- Bad children must receive no presents at all.
- If ANY of these is violated, you must output
PPCGmas is cancelled!
, exactly.
I/O Format Requirements
- The 1st input must be an array/list/comma-delimited string of full names, not just the first initial.
- The 2nd input must be a array/list/comma-delimited string of positive integers.
- The output may be any denotation of how you distributed the presents that makes sense; or
PPCGmas is Cancelled!
.
Winning Criterion: code-golf
TL;DR: Betty is a jerk, don't compete.
3
? EDIT: If one should "screw Betty", why is she in the challenge at all? \$\endgroup\$