ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Турниры > IMPC-2014-15 Questions > задача:


3rd-2. 50405 - Accounts Receivable

IMPC-2014-15 Questions

Старт: 22.ноя.2014 в 15:00:00
Финиш: 22.ноя.2014 в 20:00:00
Турнир завершён!
• Турнирная таблица

Гость
• Вопросы к жюри (1)

Задачи турнира

• 1st-3. 50484 - Number Of Letters
• 1st-4. 50473 - Counting Circles Posit...
• 1st-6. 50485 - Center of gravity of ...
• 2nd-1. 50522 - Multiplication Table - 2
• 2nd-2. 50512 - Coding redundancy
• 2nd-3. 50533 - Contacts List
• 2nd-5. 50793 - Top M Customers
• 2nd-6. 50486 - Problems and Progr...
• 3rd-2. 50405 - Accounts Receiv...
• 3rd-3. 50474 - Sum of Two Primes
• 3rd-4. 50406 - Draw Pattern 178
• 3rd-5. 50415 - The Scientist
• 3rd-6. 50695 - Longest link between...
• 4th-1. 50491 - Brokers
• 4th-2. 50524 - Elevator
• 4th-3. 50535 - Image Compression
• 4th-6. 50536 - Epoka Furgon Shpk

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Question by Mustafa Uc, prepared by Ibrahim Mesecan.

Accounts Receivable

Accounting department of your company, records the company’s credit sales to the customers in the following account: "Accounts Receivable"

Company ID:4043
170 130
200 120
. .
D.Total C.Total
370 250
Debit Balance
120
Company ID:4185
290 80
110
. .
D.Total C.Total
290 190
Debit Balance
100
Company ID: 5174
120 100
190 30
. .
D.Total C.Total
310 130
Debit Balance
180
Accounts Receivable
170 130
200 120
290 80
120 110
190 100
30
D.Total C.Total
970 570
Debit Balance
400
And every credit sale transaction is kept in two accounts: customer’s account (account receivable) and the control account (Main Accounts Receivable).

In each subsidiary account, your credit sales appear on the left part of the subsidiary account and thus, it’s the debit of the company. And payments by the company appear on the right side.

In this process, company uses a special numbering system for every process. e.g. 120 is used for credit sales and 320 is used for purchases in credit. The numbering system includes also some other information. For example, if the country is divided into several regions after process number, they use the code for the region and then the code of the each customer. e.g. 120.5875 means this is a credit sale to the customer 875 from the 5th region. 320.4125 is a credit purchase from supplier 125 from the 4th region.

Question: Write a program which reads k transactions and then finds two information:

  • The region with the highest amount of debit balance and
  • the ID of the company with the highest amount of debit balance

Input specification
You will be given one integer at the beginning, the number of transactions (k): an integer between 0 and 2000. Then, the following k lines will have 3 information:

  • Date of transaction: three integers (Year.Month.Day) separated by periods and ending with a semicolon
  • Transaction which includes period separated 2 information
    • the process ID: an integer between 1 and 1000. But the code for credit sales is 120. Thus, other codes represent other data and will not be processed in credit sales report.
    • the company ID: an integer between 1001 and 9999. The first digit of company ID defines the region the rest is the company ID in that region.
  • Amount: a floating point number between -50000 and 50000, where negative values represent your credit sales and positive values represent the payments by the respective company

Output specification
Show two information:

  1. The region code with the highest amount of debit balance and
  2. the ID of the company with the highest amount of debit balance
Note: If there are several companies with the same highest amount of debit, show the company with the smallest ID. Please also note that company ID includes the region number.

Sample Input I
12
2015.1.15; 120.5174 -190
2015.1.15; 320.5174 1800
2015.1.15; 120.4043 -200
2015.1.15; 120.5174 100
2015.1.16; 120.5174 -120
2015.1.16; 120.4043 120
2015.1.16; 120.4043 -170
2015.1.17; 120.4185 -290
2015.1.18; 120.4043 130
2015.1.18; 120.4185 80
2015.1.18; 120.5174 30
2015.1.19; 120.4185 110
Sample Output I
4 5174

Explanation: There are three companies in the report. And the second transaction starts with the code 320. Thus, it’s not a credit sale and it’s not reported here. Then, debit balance for:

  • 4043 is $120
  • 4185 is $100 and
  • 5174 is $180
So, th region 4 has the highest total debit balance: $220. And the company with the highest debit balance is 5174 with $180.

Для отправки решений необходимо выполнить вход.

www.contester.ru