#define _USE_MATH_DEFINES #include using namespace std; #define int long long vector > difficulty; map > score; vector > standing; int n; void check(string name){ bool ok = false; for(auto a : score){ if(a.first == name) ok = true; } if(ok == false){ for(int i = 0; i < n; i++){ score[name].push_back(0); } } } void solve(string name, char c){ check(name); int diff = c - 'A'; int point = 50 * difficulty[diff].first + (50 * difficulty[diff].first) / (0.8 + 0.2 * difficulty[diff].second); difficulty[diff].second++; score[name].erase(score[name].begin() + diff); score[name].insert(score[name].begin() + diff, point); } signed main(){ cin >> n; for(int i = 0; i < n; i++){ int a; cin >> a; difficulty.push_back(make_pair(a, 1)); } int t; cin >> t; for(int i = 0; i < t; i++){ string str; char p; cin >> str >> p; solve(str, p); } for(auto a : score){ string name = a.first; int sum = 0; for(int i = 0; i < a.second.size(); i++){ sum += a.second[i]; } standing.push_back(make_pair(sum, name)); } sort(standing.begin(), standing.end(), greater >()); for(int i = 0; i < standing.size(); i++){ string name = standing[i].second; cout << i + 1 << " " << name; for(int j = 0; j < score[name].size(); j++){ cout << " " << score[name][j]; } cout << " " << standing[i].first << endl; } }