It is not rare in applications for global profiles of time series to be different within a class, or, on the contrary, to show similar profiles for different classes. The aim of this work is to discriminate such complex structures of time series. We propose a new approach to learn discriminative matchings, in order to connect a set of time series, according to the common features within the classes as well as the differenciating features between the classes. Our approach is based on variance-covariance criteria, for the penalisation of links between observations, due to the variability induced within and between classes . For this, the classical expression for the variance/covariance is extended to a set of time series, then to a partition of those series. We show then how the learned matchings can be used to define a weighted local metric, restricting the comparison of the series to their discriminative features. Experiments have been conducted that underline the ability of the learned matchings to reveal accurate discriminative signatures and show the effectiveness of the learned metric to classify complex time series.