SRM 673, D2, 250-Pointer (BearSong)

James S. Plank

Tue Aug 30 00:47:32 EDT 2016

In case Topcoder is down


The Examples


Testing yourself

Like always, if you give the example number on the command line, it will run that example. If you specify "-" on the command line, you can enter the vector on standard input. If you give a number greater than 4 on the command line, then it will generate a random example, using the number as a seed. If you give a number less than -4, then it will generate a random example, using the negated number as a seed, and it will print the vector on standard output. So, for example, if you want to see the vector for seed 2006, then do "./a.out -2006".

Like the Cryptography Problem, I have a shell script tests.sh, that you can use to test your program. When you run tests.sh, your answer should be identical to answers.txt

Examples with small vectors: 5907, 8051, 2006, 4150, 6294, 249, 8438, 2393 and 4537. ~\>

Hints

This is a map problem (unordered is better than ordered). Create a map whose key is the pitch, and whose value is the number of times that you see the pitch. Your first step is to run through the pitches, and create/update the elements in the map.

Your second step is to traverse the map and count the number of entries whose second field equals one.


My Solution.