using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Slayter
{
    class Comparator : IEqualityComparer<int[]>
    {
        // Products are equal if their names and product numbers are equal. 
        public bool Equals(int[] x, int[] y)
        {
            if (Object.ReferenceEquals(x, y)) return true;
            if (Object.ReferenceEquals(x, null) || Object.ReferenceEquals(y, null))
                return false;
            bool result = true;
            if (x.Length != y.Length)
                return false;
            for (int i = 0; i < x.Length; i++)
            {
                if (x[i] != y[i])
                {
                    result = false;
                    break;
                }
            }
                return result;
        }

        public int GetHashCode(int[] product)
        {
            if (Object.ReferenceEquals(product, null)) return 0;


            return product[0].GetHashCode() ^ product[1].GetHashCode();
        }
    }
}
