#include <utility>
#include <vector>
#include <iostream>
#include <algorithm>
int main()
{
typedef std::pair<std::string, size_t> p_sui;
size_t N;
std::cin >> N;
std::vector<p_sui> vec(N);
for(size_t i = 0; i < N; i++)
std::cin >> vec[i].first >> vec[i].second;
}
std::cout << "Фамилия: " << std::max_element(vec.begin(), vec.end(), [](p_sui var1, p_sui var2)
return var1.second < var2.second;
})->first << std::endl;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <utility>
#include <vector>
#include <iostream>
#include <algorithm>
int main()
{
typedef std::pair<std::string, size_t> p_sui;
size_t N;
std::cin >> N;
std::vector<p_sui> vec(N);
for(size_t i = 0; i < N; i++)
{
std::cin >> vec[i].first >> vec[i].second;
}
std::cout << "Фамилия: " << std::max_element(vec.begin(), vec.end(), [](p_sui var1, p_sui var2)
{
return var1.second < var2.second;
})->first << std::endl;
}