لینکهای مفید برای شرکت در مسابقه:
در طول مسابقه، میتوانید سؤالات خود را از قسمت «سؤال بپرسید» مطرح کنید.
In the dormitory, people will take turns to buy dinner or stuff for dinner. Each night one person goes out to buy and writes details of it on the “Detail Paper”. Details include name of the buyer, amount of money he/she paid and name of the people ate that night.
At the end of each month everybody have to pay their debts, But everyone get’s so creepy when it comes to money. So they all decided to hire a team from ACM(Abdominal Control Market) of the SBU University. you are one of the teams participating in ACM Newbies Contest so you have to help them. They only have two rules:
There are some test cases in one test(at most 200), Each test case contains an integer , number of lines to follow. Each line of test case is as following: A string name of the buyer followed by an integer cost of things bought followed by an integer , indicating how many people ate that specific night, Following space separated strings indicating of the people that ate that night. It’s guaranteed that is divisible by and Each line contains no more than characters. Each contains “A-Z” and “a-z” characters. are NOT case-sensitive and length of each name is at most 20 characters. (Case-Sensitive: ‘a’ ≠ ‘A’, not case-sensitive: ‘a’ = ‘A’)
For each test case output “Case #X:” (quotations for clarify) which is the number of test case. Then print “Debtors:” (quotations for clarify) and in each line print name of debtors and their liability as following sorted by debtors name in alphabetical order:
S owes D Tomans.
First alphabetical character of must be uppercase and rest of alphabetical characters must be lowercase, is an integer number (money person must pay). Then print “Creditors:” (quotations for clarify) and in each line print name of creditors and their credit as following sorted by creditors name in alphabetical order:
S paid D Tomans.
First alphabetical character of must be uppercase and rest of alphabetical characters must be lowercase, is an integer number (money person must get). People who don’t have to pay or receive any money are neither Debtor nor Creditor, so their name should not appear in output.