G - Gorggeous Peters Great Friend Gym - 102448G(模擬)

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

思路:
模擬

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
#include <iostream>

using namespace std;

const int maxn = 5e4 + 7;

string str[maxn];
map<string,int>mp;
map<string,int>score;
int cnt = 0;
int ans[maxn];

int main() {
    int c,p,s;scanf("%d%d%d",&c,&p,&s);
    for(int i = 1;i <= c;i++) {
        cin >> str[i];
        mp[str[i]] = i;
    }
    for(int i = 1;i <= p;i++) {
        string now;cin >> now;
        int x;scanf("%d",&x);
        score[now] = x;
    }
    for(int i = 1;i <= s;i++) {
        string s1,s2,s3;
        cin >> s1 >> s2 >> s3;
        int pos = mp[s1];
        int num = score[s2];
        if(s3 == "AC") {
            ans[pos] += num;
        }
    }
    for(int i = 1;i <= c;i++) {
        cout << str[i] << " " << ans[i] << endl;
    }
    return 0;
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章