{"problem":{"name":"G. Gorggeous Peter's Great Friend","description":{"content":"Gorggeous Peter was the first employee of the company Inlouco and also from the single team from UFPE that won the Latin American award at ICPC, being a strong influencer in the tradition of the Marat","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10244G"},"statements":[{"statement_type":"Markdown","content":"Gorggeous Peter was the first employee of the company Inlouco and also from the single team from UFPE that won the Latin American award at ICPC, being a strong influencer in the tradition of the Maratona CIn and a great friend of the UFPE marathonists, sometimes being called the godfather of the marathonists.\n\nOne of the reasons he is called the godfather of the marathonists is that he convinced Inlouco to sponsor the Brazilian finals, which included an amazing lecture of his that was so good it made a lot of marathonists apply to Inlouco's internship. Because of that, he had the idea of creating an initial phase of the hiring process to filter out the candidates.\n\nFor this phase, he selected some problems from the website ForceCodes, assigning $S c o r e_j$ to the $j$-th problem. After eating açai with his great friend, Gabriel he opened the ForceCodes submissions page and noticed that it had all submissions from all users of the website.\n\nGorggeous then decided to write a program that would receive this list of submissions and return the score $A n s_i$ of each candidate, where this score would be the sum of the scores $S c o r e_j$ of all problems $j$ he received the verdict $A C$. However, since Gorggeous noticed this problem was too easy to him and would not be fun to solve, he asked that you, his new great friend, *metesse bronca!!*\n\nNote: it is guaranteed that after a user receives the verdict $A C$ in a problem, he will not submit in the same problem again.\n\nThe first line of input contains three integers $C$, $P$ e $S$ ($0 < C, P, S <= 5 dot.op 10^4$) respectively the amount of candidates, the amount of problems Gorggeous selected and the number of submissions.\n\nThe $i$-th of the next $C$ lines contain the string $H a n d l e_i$ of $i$-t candidate.\n\nThe $j$-th of the next $P$ lines contain the string $I d_j$ and the integer $S c o r e_j$ ($0 < S c o r e_j <= 2 dot.op 10^4$) of the $j$-th problem Gorggeous selected.\n\nThe $k$-th of the next $S$ lines contain three strings $U s e r_k$, $P r o b l e m_k$ and $V e r d i c t_k$, which means that the user with handle $U s e r_k$ submitted in the problem with id $P r o b l e m_k$ and received verdict $V e r d i c t_k$.\n\nIt is guaranteed that all strings from the input contains only letters and numbers and no more than $20$ characters long.\n\nYou should print $C$ lines, where the $i$-th of them should contains the string $H a n d l e_i$ and the integer $A n s_i$, the score of the $i$-th candidate.\n\n## Input\n\nThe first line of input contains three integers $C$, $P$ e $S$ ($0 < C, P, S <= 5 dot.op 10^4$) respectively the amount of candidates, the amount of problems Gorggeous selected and the number of submissions.The $i$-th of the next $C$ lines contain the string $H a n d l e_i$ of $i$-t candidate.The $j$-th of the next $P$ lines contain the string $I d_j$ and the integer $S c o r e_j$ ($0 < S c o r e_j <= 2 dot.op 10^4$) of the $j$-th problem Gorggeous selected.The $k$-th of the next $S$ lines contain three strings $U s e r_k$, $P r o b l e m_k$ and $V e r d i c t_k$, which means that the user with handle $U s e r_k$ submitted in the problem with id $P r o b l e m_k$ and received verdict $V e r d i c t_k$.It is guaranteed that all strings from the input contains only letters and numbers and no more than $20$ characters long.\n\n## Output\n\nYou should print $C$ lines, where the $i$-th of them should contains the string $H a n d l e_i$ and the integer $A n s_i$, the score of the $i$-th candidate.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ C, P, S \\in \\mathbb{Z}^+ $ denote the number of candidates, problems, and submissions, respectively.  \nLet $ H = \\{h_1, h_2, \\dots, h_C\\} $ be the set of candidate handles.  \nLet $ \\mathcal{P} = \\{(id_j, score_j) \\mid j \\in \\{1, \\dots, P\\}\\} $ be the set of problems, where $ id_j $ is the problem identifier and $ score_j \\in \\mathbb{Z}^+ $ is its score.  \nLet $ \\mathcal{S} = \\{(user_k, problem_k, verdict_k) \\mid k \\in \\{1, \\dots, S\\}\\} $ be the set of submissions, where $ verdict_k \\in \\{\\text{AC}, \\text{other}\\} $.  \n\n**Constraints**  \n1. $ 0 < C, P, S \\leq 5 \\cdot 10^4 $  \n2. All handles and problem IDs are unique strings of length $ \\leq 20 $, containing only alphanumeric characters.  \n3. For each problem $ id_j $, if a candidate receives an \"AC\" verdict, no further submissions for that problem by the same candidate exist.  \n4. $ 0 < score_j \\leq 2 \\cdot 10^4 $ for all $ j $.  \n\n**Objective**  \nFor each candidate $ h_i \\in H $, compute:  \n$$\nAns_i = \\sum_{\\substack{(user_k, problem_k, \\text{AC}) \\in \\mathcal{S} \\\\ user_k = h_i}} score_j \\quad \\text{where } id_j = problem_k\n$$  \nOutput $ (h_i, Ans_i) $ for each $ i \\in \\{1, \\dots, C\\} $, in order.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10244G","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}