QOJ.ac

QOJ

Limite de temps : 2 s Limite de mémoire : 256 MB Points totaux : 100

#22751. Salda bankowe

Statistiques

Alice, Betsy, Corinne i Debra otwierają konta. Bank ma centralny rejestr wpłat (do banku) i wypłat (z banku). Odpowiedzialne, nigdy nie wypłacają więcej niż mają.

Dany rejestr (format niżej), wypisz końcowe salda. Początek 0 każda, liczby mieszczą się w 32-bitowych całkowitych.

Wejście

  • Wiersz 1: całkowita $N$, liczba transakcji.

  • Wiersze $2$ do $N+1$: dwa pola, imię i liczba; dodatnia wpłata, ujemna wypłata.

Wyjście

  • Wiersze $1..4$: imię i saldo, alfabetycznie.

Przykład

Wejście 1

6
Alice +100
Corinne +100
Betsy +200
Alice -10
Debra +10
Betsy -100

Wyjście 1

Alice 90
Betsy 100
Corinne 100
Debra 10

Uwagi

Szczegóły wejścia

Alice wpłaca 100, Corrinne też, Betsy 200. Alice wypłaca 10, Debra wpłaca 10, Betsy wypłaca 100. Tylko Alice, Betsy, Corinne, Debra.

Autor: Rob Kolstad, 2004

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.