SPOJ SBANK

From Algorithmist
Jump to: navigation, search

27 - SBANK - Sorting Bank Account[edit]

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

Explanation[edit]

The input is a list of bank account numbers in a common format but are unsorted. The output is an enumeration of each account number, followed by the number of times a given account number appears.

The problem is solvable through a direct data structure.

Gotchas[edit]

  • Make sure you are using a fast method to compare bank account numbers. For example, comparing strings is slower than comparing integers.

Notes[edit]

Implementations[edit]

Optimizations[edit]

Input[edit]

  • t [the number of tests <= 5]
  • n [the number of accounts<= 100 000]
  • [list of accounts]
  • [empty line]
  • [next test cases]
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[edit]

  • [sorted list of accounts with the number of repeated accounts]
  • [empty line]
  • [other results]
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

References[edit]

  1. Reference 1

Categories here, use the form [[Category: Category Name]], see Categories for a list