https://pastein.ru/t/ZE

  скопируйте уникальную ссылку для отправки


#include "pch.h"
#include <iostream>
#include <map>
#include <algorithm>
#include <iterator> 
using namespace std;

int main()
{
	setlocale(LC_ALL, "Russian");
	multimap< double, double> a;
	multimap< double, double> ::iterator M;

	int n, max = 0, min = 10;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		a.insert(make_pair(i, rand() % 30));
	}
	
	for (M = a.begin(); M != a.end(); M++)
	{
		cout << (*M).first << " " << (*M).second << endl;
		if (max < (*M).second)
			max = (*M).second;
	}

	cout << max << endl;

	for (M = a.begin(); M != a.end(); M++)
	{
		if (min > (*M).second)
			min = (*M).first;
	}
	
	a.erase(min);

	for (M = a.begin(); M != a.end(); M++)
	{
		cout << (*M).first << " " << (*M).second << endl;
	}
}