Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
495 B
1
Indexable
Never
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
	int n,x;
	cin >> n >> x;
	int *m =(int*) calloc(n, sizeof(int));
	int delim = x % 2;

	for (int i = 0; i < n; i++)
	{
		cin >> m[i];
	}

	int B, R, M;
	B = 0;
	R = 0;
	M = 0;
	for (int i = 0; i < n; i++)
	{
		if (m[i] % 2 == delim)
		{
			if (m[i] % 2 == x % 2) {
				if (m[i] < x) M++;
				else if (m[i] == x) R++;
				else B++;
			}
		}
	}
	cout <<M << " " << R << " "<<B <<"\n";
	
}