CCC '22 S2 - Good Groups
OK, you knew there had to be a Y2K problem, so here it is.
You are given a document containing text and numerical data, which may include dates. Your task is to identify (two-digit) years and to reprint the document with these two-digit years replaced by four-digit years. You may assume that any year numbered 24 or less is in the 2000's, while any year numbered 25 or more is in the 1900's (e.g. 16 represents the year 2016 and 26 represents the year 1926). Yes, we know this rule may imply that your grandmother hasn't been born yet.
Your program is to recognize dates in any of three formats:
dd/mm/yy
yy.mm.dd
Month,dd,yy| Marks Awarded | Number of Groups | Number of Constraints |
|---|---|---|
| \(3\) marks | \(G \le 50\) | \(X \le 50\) and \(Y = 0\) |
| \(5\) marks | \(G \le 50\) | \(X \le 50\) and \(Y \le 50\) |
| \(7\) marks | \(G \le 100\,000\) | \(X \le 100\,000\) and \(Y \le 100\,000\) |
Output Specification
Output an integer between \(0\) and \(X + Y\) which is the number of constraints that are violated.
Sample Input 1
1
ELODIE CHI
0
2
DWAYNE BEN ANJALI
CHI FRANCOIS ELODIEOutput for Sample Input 1
0Explanation of Output for Sample Input 1
There is only one constraint and it is not violated: ELODIE and CHI are in the same group.
Sample Input 2
3
A B
G L
J K
2
D F
D G
4
A C G
B D F
E H I
J K LOutput for Sample Input 2
3Explanation of Output for Sample Input 2
The first constraint is that A and B must be in the same group. This is violated.
The second constraint is that G and L must be in the same group. This is violated.
The third constraint is that J and K must be in the same group. This is not violated.
The fourth constraint is that D and F must not be in the same group. This is violated.
The fifth constraint is that D and G must not be in the same group. This is not violated.
Of the five constraints, three are violated.
Comments