Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <set>
- #include <vector>
- #include <map>
- #include <math.h>
- using namespace std;
- map<int, vector<string>> mp;
- int main()
- {
- #if _DEBUG
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- #endif
- int n, m, x;
- cin >> n >> m;
- string w;
- vector<int> start(m);
- cin >> w;
- for (int j = 0; j < m; ++j) {
- cin >> start[j];
- }
- vector<int> tmp(m);
- int maxx = -1e9;
- vector<string> ans;
- for (int i = 0; i < n - 1; ++i) {
- cin >> w;
- for (int j = 0; j < m; ++j) {
- cin >> tmp[j];
- }
- int sc = 0;
- for (int j = 0; j < m; ++j) {
- sc += start[j] * tmp[j];
- }
- if (sc > maxx) {
- ans.clear();
- ans.push_back(w);
- maxx = sc;
- }
- else if (sc == maxx) {
- ans.push_back(w);
- }
- }
- for (auto x : ans) {
- cout << x << "\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment