Gym - 102448G Gorggeous Peter‘s Great Friend (模拟)

    技术2024-05-11  83

    Descripton 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.

    One 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.

    For this phase, he selected some problems from the website ForceCodes, assigning Scorej 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.

    Gorggeous then decided to write a program that would receive this list of submissions and return the score Ansi of each candidate, where this score would be the sum of the scores Scorej of all problems j he received the verdict AC. 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!!

    Note: it is guaranteed that after a user receives the verdict AC in a problem, he will not submit in the same problem again.

    Input The first line of input contains three integers C, P e S (0<C,P,S≤5⋅104) 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 Handlei of i-t candidate.

    The j-th of the next P lines contain the string Idj and the integer Scorej (0<Scorej≤2⋅104) of the j-th problem Gorggeous selected.

    The k-th of the next S lines contain three strings Userk, Problemk and Verdictk, which means that the user with handle Userk submitted in the problem with id Problemk and received verdict Verdictk.

    It is guaranteed that all strings from the input contains only letters and numbers and no more than 20 characters long.

    Output You should print C lines, where the i-th of them should contains the string Handlei and the integer Ansi, the score of the i-th candidate.

    Example

    Input 2 2 4 GabrielPessoa beza metebronca 100 geometry 200 beza metebronca AC ffern numbertheory AC GabrielPessoa geometry WA beza geometry AC

    Output GabrielPessoa 0 beza 300

    Solution 模拟

    Code

    #include <bits/stdc++.h> using namespace std; const int MX = 5e4 + 7; struct user_node{ string name; int sco; }user[MX]; map<string,int>pro; map<string,int>to_user; int main(){ int C, P, S;cin >> C >> P >> S; for(int i = 1;i <= C;++i){ string tmp;cin >> tmp; user[i].name = tmp; to_user[tmp] = i; } for(int i = 1;i <= P;++i){ string tmp;int k;cin >> tmp >> k; pro[tmp] = k; } for(int i = 1;i <= S;++i){ string u, p, ver;cin >> u >> p >> ver; if(ver == "WA") continue; user[to_user[u]].sco += pro[p]; } for(int i = 1;i <= C;++i){ cout << user[i].name << " " << user[i].sco << endl; } }
    Processed: 0.011, SQL: 9