Code collaboration game!
Objective: Solve a problem using C++ with other forum members! Have fun! Test your patience, skills, and ability to work with others.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
Rules:
1. Take the code above your post and add ONLY ONE line of code to the program. Arrange the code and add/remove brackets as you see fit.
Then post the modified code. MAKE SURE YOUR SYNTAX IS CORRECT.
2. You can choose to remove a line of code, state the line you are removing then post the modified program. YOU CAN ONLY REMOVE ONE LINE.
Ie. Remove func(badparameters);
3. DO NOT declare entire structures/classes. Ie. struct structure_name {} is considered one line. A constructor is one line.
4. You CANNOT post consecutively; you can add/remove another line ONLY after someone else has added/removed a line of code.
5. If duplicate lines of code from separate users get posted, the duplicate is ignored. ie. USER1 void main() USER 2 void main() .
6. A comment following a line of code you are adding is allowed. A suggestion to the next poster is allowed on your turn.
Ie. We need a variable to store an account number, but no syntax suggestions allowed.
7. DO NOT complete the program on your own and post your solution for others to see! The game would then become a fill in the blank game.
|
Suggestions for additional rules are welcome. Good luck!
PROBLEM
In one of the internet banks thousands of operations are being performed every day. Since certain customers do business more actively than others, some of the bank accounts occur many times in the list of operations. Your task is to sort the bank account numbers in ascending order. If an account appears twice or more in the list, write the number of repetitions just after the account number. The format of accounts is as follows: 2 control digits, an 8-digit code of the bank, 16 digits identifying the owner (written in groups of four digits), for example (at the end of each line there is exactly one space):
30 10103538 2222 1233 6160 0142
Banks are real-time institutions and they need FAST solutions. If you feel you can meet the challenge within a very stringent time limit, go ahead! A well designed sorting algorithm in a fast language is likely to succeed.
Input
t [the number of tests <= 5]
n [the number of accounts<= 100 000]
[list of accounts]
[empty line]
[next test cases]
Output
[sorted list of accounts with the number of repeated accounts]
[empty line]
[other results]
Example
Input:
2
6
03 10103538 2222 1233 6160 0142
03 10103538 2222 1233 6160 0141
30 10103538 2222 1233 6160 0141
30 10103538 2222 1233 6160 0142
30 10103538 2222 1233 6160 0141
30 10103538 2222 1233 6160 0142
5
30 10103538 2222 1233 6160 0144
30 10103538 2222 1233 6160 0142
30 10103538 2222 1233 6160 0145
30 10103538 2222 1233 6160 0146
30 10103538 2222 1233 6160 0143
Output:
03 10103538 2222 1233 6160 0141 1
03 10103538 2222 1233 6160 0142 1
30 10103538 2222 1233 6160 0141 2
30 10103538 2222 1233 6160 0142 2
30 10103538 2222 1233 6160 0142 1
30 10103538 2222 1233 6160 0143 1
30 10103538 2222 1233 6160 0144 1
30 10103538 2222 1233 6160 0145 1
30 10103538 2222 1233 6160 0146 1