Код: Выделить всё
#include
#include
#include
#define ll long long
#define nl '\n'
using namespace std;
void solve()
{
int n, k;
cin >> n >> k;
int a[n];
for (int i = 0; i < n; ++i)
cin >> a[i];
sort(a, a + n);
vector count(1, 1);
for (int i = 1; i < n; ++i)
{
if (a[i] == a[i - 1])
count.back()++;
else
count.push_back(1);
}
sort(count.begin(), count.end());
int m = count.size();
for (int i = 0; i < m - 1; ++i)
{
if (count[i] > k)
{
cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79365526/why-is-iostream-behavior-different-on-mac-sequoia-15-2[/url]
Мобильная версия