Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <map>
- #include <string>
- #include <algorithm>
- using namespace std;
- int main()
- {
- int i, j, N, k;
- cin >> N >> k;
- map<string, vector<int>> mymap;
- string Name;
- vector<int> a (k);
- for (i = 0; i < N; i++){
- cin >> Name;
- for (j = 0; j < k; j++) cin >> a[j];
- mymap.insert(pair<string, vector<int>> (Name, a));
- }
- vector<int> p (k);
- for (j = 0; j < k; j++) cin >> p[j];
- sort(p.begin(), p.end());
- for (j = 0; j < k; j++) cout << p[j] << '\t';
- cout << endl;
- for (auto elem: mymap) {
- cout << elem.first << '\t';
- for (j = 0; j < k; j++) cout << elem.second[j] << '\t';
- cout << endl;
- }
- }
Add Comment
Please, Sign In to add comment