Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _USE_MATH_DEFINES
- #include <iostream>
- #include <string>
- #include <cmath>
- #include <vector>
- #include <algorithm>
- #include <map>
- int main()
- {
- int n, cnt = 0;
- scanf("%d", &n);
- std::map<std::string, int> mp;
- for (int i = 0; i < n; i++)
- {
- std::string name;
- std::cin >> name;
- mp[name] = cnt++;
- }
- std::vector<std::string> results;
- for (int i = 0; i < n; i++)
- {
- std::string name;
- std::cin >> name;
- results.push_back(name);
- }
- std::vector<std::pair<int, std::string>> rises;
- for (int i = 0; i < results.size(); i++)
- if (i < mp[results[i]])
- rises.push_back(std::make_pair(mp[results[i]] - i, results[i]));
- if(rises.empty())
- printf("suspicious\n");
- else
- {
- std::sort(rises.begin(), rises.end(), [](std::pair<int, std::string>& l, std::pair<int, std::string>& r)
- {
- return l.first > r.first;
- });
- printf("%s\n", rises[0].second.c_str());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement