Skip to content

Instantly share code, notes, and snippets.

@bokmann
Last active April 2, 2017 11:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bokmann/ebe7737eba52932ba744 to your computer and use it in GitHub Desktop.
Save bokmann/ebe7737eba52932ba744 to your computer and use it in GitHub Desktop.
This problem was originally in the 2015 VCU Computer Science Competition
Problem A The Daycare
The daycare Nannies R Us has installed a new high-tech system for keeping track of which children are under
its supervision at any moment in time. Each parent of a child has a card with a unique ID, where the ID is
some integer x. Every morning, the parent swipes the card at a card-reader when dropping their child off at
the daycare. The system then adds x to an array of integers. In the evening, when the parent comes to pick
up the child, the same card is swiped, and a second copy of x is added to the list. Each night at midnight,
the array is wiped clean and reset to have zero elements. In this way, the daycare can quickly check every
afternoon which children are yet to be picked up by their parents by picking out the array elements that
occur precisely once. Unfortunately, at 4:55 pm on Friday, March 13, 2015, the daycare realizes that
somewhere in their daycare is precisely one child who is yet to be picked up – can you help them determine
the integer ID of this child?
Input
The input consists of two rows. On the first row, an integer n satisfying 1<= n <= 10,000 is given. On the
second row, a sequence of n integers is given.
Output
The ID of the child left in the daycare.
Sample Inputs
7
1 1 2 9 -11 -11 9
9
1 2 1 3 2 4 3 4 5
Sample Outputs
2 5
@ubermajestix
Copy link

The input is confusing, what data am I ingesting? The first row (i.e. line?) is an int, ok, so is that an ID of a child? Are they coming or going? The second row (line?) is a sequence of ints, so is that the array of checkins and checkouts?

The sample input is confusing to, there are 3 lines of data, is 9 121324345 supposed to be on the line above?

@bokmann
Copy link
Author

bokmann commented Apr 2, 2017

There are supposed to be spaces in the second line.., I'll correct that... but the input and description is exactly as provided in the competition. Part of the competition is to figure out from the description the exact meaning of the data. In this example, the way it talks about the card being swiped is the major clue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment