Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstring>
- #include <map>
- #include <deque>
- #include <queue>
- #include <stack>
- #include <sstream>
- #include <iostream>
- #include <iomanip>
- #include <cstdio>
- #include <cmath>
- #include <cstdlib>
- #include <ctime>
- #include <algorithm>
- #include <vector>
- #include <set>
- #include <complex>
- #include <list>
- #include <climits>
- #include <cctype>
- using namespace std;
- int main() {
- string myName;
- cin >> myName;
- int n;
- cin >> n;
- map<string, int> factor;
- string name1, action, temp, name2;
- for (int i = 0; i < n; i++) {
- cin >> name1;
- cin >> action;
- if (action == "posted" || action == "commented")
- cin >> temp;
- cin >> name2;
- name2 = name2.substr(0, name2.length() - 2);
- cin >> temp;
- int val = 5;
- if (action == "posted")
- val = 15;
- else if (action == "commented")
- val = 10;
- if (name1 == myName)
- factor[name2] += val;
- else
- factor[name1];
- if (name2 == myName)
- factor[name1] += val;
- else
- factor[name2];
- }
- vector<pair<int, string> > ret;
- for (map<string, int>::iterator it = factor.begin(); it != factor.end(); it++)
- ret.push_back(make_pair(-it->second, it->first));
- sort(ret.begin(), ret.end());
- int m = ret.size();
- for (int i = 0; i < m; i++)
- cout << ret[i].second << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement