Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <string>
- #include <vector>
- #include <queue>
- #include <fstream>
- #include <algorithm>
- using namespace std;
- int main()
- {
- int count = 0;
- int n;
- cin >> n;
- vector <vector <string> > c(n);
- vector <int> dic(n);
- for (int i = 0; i < n; i++)
- {
- cin >> dic[i];
- c[i].resize(dic[i]);
- for (int j = 0; j < dic[i]; j++)
- cin >> c[i][j];
- }
- int k;
- cin >> k;
- vector <string> a(k);
- vector <pair <int, int> > ans(n);
- for (int i = 0; i < n; i++)
- ans[i].second = i;
- for (int i = 0; i < k; i++)
- {
- cin >> a[i];
- for (int j = 0; i < n; j++)
- {
- for (int l = 0; l < dic[i]; l++)
- {
- if (a[i] == c[j][l])
- {
- ans[j].first++;
- }
- }
- }
- }
- sort(ans.begin(), ans.end());
- int z = 0;
- while (ans[0].first == ans[0].first)
- {
- count++;
- z++;
- }
- cout << count << ' ' << ans[0].first;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement