#define _USE_MATH_DEFINES #define _CRT_SECURE_NO_WARNINGS #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; //#include int main() { mapp; int n, m, s; int a; cin >> n; vector>w; while (n--) { cin >> a >> m >> s ; string t; for (int i = 0; i < m; i++) { cin >> t; p[t] += s; w.push_back(make_pair( p[t],t)); } } sort(w.begin(), w.end()); reverse(w.begin(), w.end()); mapy; vector>b; vectork; int e = 0; vector>wr; for (int i = 0; i < w.size(); i++) { vector>q; // cout << w[i].second<< endl; for (int j = i; j < w.size(); j++) { //cout < 20)break; } for(int j=0;j j; i--) { if (wr[i].first == wr[i - 1].first&&wr[i].second < wr[i - 1].second)swap(wr[i], wr[i - 1]); } for (int i = 0; i < wr.size()||i<10; i++) { cout << wr[i].second << " " << wr[i].first << endl; /*if (y[w[i].second])continue; cout << w[i].second << " " << w[i].first << endl; y[w[i].second] = 1; */ } return 0; }