Under construction

Still being built. Things may change

The Dean's Directive

Time limit1sMemory limit128 MB

Summary
Process bank commands that create, reset, deposit to, withdraw from, transfer between, and report on up to 10000 accounts with exact formatting.
Level

Easy3 of 10

Topics
Simulation, Hash map, Implementation
Solved
No attempts yet

Problem

Rebuilding the Faculty of Mathematics and Physics building in Malá Strana will cost a great deal of money. Just feeding the programmers who work on making the builders more efficient runs up a bill for baguettes, Coca-Cola and the staff who keep those programmers' basic life functions going. The salaries of the group that checks how efficient the programmers are is better left unmentioned. The dean therefore issued directive SM2001/364 on the control of money flow.

The directive settles which employee may release money for mortar, which one for bricks and which one for windows. It also orders that every record of faculty spending is archived and guarded, and it fixes how offers from suppliers are written down and how the faculty picks a supplier and, where needed, its subcontractors.

Suppose the faculty received offers from fifty companies. Every company needs raw material for its product, and some other company can deliver that material. The price of a finished product follows from the prices of the materials it is made of. The faculty now has to work out how to buy the materials it needs as cheaply as possible.

Apart from the building work, the everyday running of the faculty has to be paid for as well. Besides its share of the faculty budget, each department collects grant money and money from sponsors, and it spends that on new hardware and software. To make the whole funding system easy to follow, a commission appointed by the dean was put in charge of a single faculty finance program.

When the analysts on the faculty payroll saw the task, they went pale and turned it down as unsolvable. The commission dropped that part of the regulation for now and asked for at least the part of the directive that governs faculty accounts.

The directive says that every operation on an account has to go through one special faculty program that records the information and points out anything that does not add up. Writing that program is your job.

Input

The input has several lines. Each line holds one bank operation. There are seven operations.

  • ZALOZ account
  • ULOZ account amount
  • VYBER account amount
  • PREVED account1 account2 amount
  • STATISTIKA
  • LIST
  • RESET

account is a ten-digit account number, and a leading zero belongs to the number, so write it out. amount is a number with exactly two digits after the decimal point. The bank holds at most 10 000 accounts at any moment.

ZALOZ creates a new account with the number account.

ULOZ deposits amount into the account account.

VYBER withdraws amount from the account account.

PREVED moves amount from account1 to account2.

STATISTIKA and LIST only print information about the accounts in the bank.

RESET cancels every existing account and returns the system to its initial state.

Process the operations in the order they are written, until the end of the input.

Output

In the messages below, put the actual values in place of account, account1, account2 and amount.

ZALOZ prints Ucet account vytvoren.. If an account with that number already exists, it prints Ucet account uz existuje. instead.

ULOZ prints Ulozeno amount na ucet account.. If the account does not exist, it prints Ucet account neexistuje..

VYBER prints Vybrano amount z uctu account.. If the account does not exist, it prints Ucet account neexistuje.. If the balance is smaller than amount, it prints Nedostatek penez. and no money moves.

PREVED prints Prevedeno amount z uctu account1 na ucet account2. when the transfer goes through. If account1 does not exist, it prints Ucet account1 neexistuje.. If account1 exists but its balance is smaller than amount, it prints Nedostatek penez.. On top of that, if account2 does not exist, Ucet account2 neexistuje. follows on the next line, and no money moves.

STATISTIKA prints Pocet uctu: XXXX, where XXXX is the number of accounts in the bank, written without padding. The next line is Celkem: YYYY, where YYYY is the sum of the money on all accounts. Write the whole part of the sum right aligned in seven columns, then the decimal point, then exactly two decimal digits. Five spaces sit between Celkem: and that seven-column field. A whole part longer than seven digits is written out in full and makes the line longer.

LIST prints Pocet uctu: XXXX first, then one line per account, in the order the accounts were created. Each line holds the account number, one space, and the balance written the same way as the sum. After the last account comes the line Celkem: YYYY with the sum of all balances.

RESET prints Reset systemu..

Every amount is written with exactly two decimal digits. Put one blank line between the output of two operations. After the last operation, print Konec. on a line of its own.

Examples1

  1. Example 1

    Input
    ZALOZ 0000000001
    ULOZ 0000000001 2.00
    VYBER 0000000001 1.00
    STATISTIKA
    RESET
    ZALOZ 1000000001
    ULOZ 1000000001 20.50
    ZALOZ 1000000002
    PREVED 1000000001 1000000002 15.25
    ZALOZ 1000000002
    VYBER 1000000002 14.00
    VYBER 1000000002 10.00
    LIST
    
    Expected output
    Ucet 0000000001 vytvoren.
    
    Ulozeno 2.00 na ucet 0000000001.
    
    Vybrano 1.00 z uctu 0000000001.
    
    Pocet uctu: 1
    Celkem:           1.00
    
    Reset systemu.
    
    Ucet 1000000001 vytvoren.
    
    Ulozeno 20.50 na ucet 1000000001.
    
    Ucet 1000000002 vytvoren.
    
    Prevedeno 15.25 z uctu 1000000001 na ucet 1000000002.
    
    Ucet 1000000002 uz existuje.
    
    Vybrano 14.00 z uctu 1000000002.
    
    Nedostatek penez.
    
    Pocet uctu: 2
    1000000001       5.25
    1000000002       1.25
    Celkem:           6.50
    
    Konec.