Problem
A multiset is a generalization of the notion of set to include a collection of objects in which each object may occur more than once (the order in which objects are given is still unimportant). For a multiset , the multiplicity of an element is the number of times that occurs in the set; this multiplicity is denoted . Note that every set is included in the definition of multiset.
The Minkowski sum of multisets and containing real numbers is the new multiset formed by taking all possible sums of an element from and an element from . The Minkowski sum could be defined more concisely as , The Minkowski difference is defined analogously by taking all possible differences .
If and represent simplified spectra taken from two peptides, then is called the spectral convolution of and . In this notation, the shared peaks count is represented by , and the value of for which has the maximal value is the shift value maximizing the number of shared masses of and .
Given: Two multisets of positive real numbers and . The size of each multiset is at most 200.
Return: The largest multiplicity of , as well as the absolute value of the number maximizing (you may return any such value if multiple solutions exist).
阿多集是的概念的概括集合包括对象的集合,其中多于一次,可能会出现的每个对象(在该对象被给定的顺序是不重要的仍然)。对于多集 ,元素的多重性 是多少次 发生在集合中;这种多样性表示为。注意,每个集合都包含在多集合的定义中。
多集的Minkowski和 和 包含实数的是新的多集 由所有可能的总和组成 元素的 从 和一个元素 从 。Minkowski和可以更简洁地定义为,明可夫斯基的区别 通过采取所有可能的差异类似地定义 。
如果 和 代表从两个肽段获取的简化光谱,然后 被称为光谱卷积的 和 。在此表示法中,共享峰数由,以及 为此 具有最大值是使最大共享质量数最大的位移值 和 。
给定:正实数的两个多集 和 。每个多集的大小最多为200。
返回:最大的多重性,以及数字的绝对值 最大化 (如果存在多个解决方案,则可以返回任何此类值)。
Sample Dataset
186.07931 287.12699 548.20532 580.18077 681.22845 706.27446 782.27613 968.35544 968.35544 101.04768 158.06914 202.09536 318.09979 419.14747 463.17369
Sample Output
3 85.03163
Note
Observe that is equivalent to , but it is not usually the case that is the same as ; in this case, one multiset can be obtained from the other by negating every element.
观察一下 相当于 ,但通常情况并非如此 是相同的 ; 在这种情况下,通过取反每个元素可以从另一个获得一个多集。