CodeforcesRound #261 (Div.2) B. PashmakandFlowers (easy)

Source: Internet
Author: User
PashmakdecidedtogiveParmidaapairofflowersfromthegarden. Therearenflowersinthegardenandthei-thofthemhasabeautynumberbi.Parmidaisaverystrangegirlsoshedoesntwanttohavethetwomostbeautifulflowers

Pashmak decided to give Parmida a pair of flowers from the garden. there are n flowers in the garden and the I-th of them has a beauty number B I. parmida is a very strange girl so she doesn't want to have the two most beautiful flowers

Pashmak decided to give Parmida a pair of flowers from the garden. There areNFlowers in the garden andI-Th of them has a beauty numberBI. Parmida is a very strange girl so she doesn't want to have the two most beautiful flowers necessarily. She wants to have those pairs of flowers that their beauty difference is maximal possible!

Your task is to write a program which calculates two things:

  1. The maximum beauty difference of flowers that Pashmak can give to Parmida.
  2. The number of ways that Pashmak can pick the flowers. two ways are considered different if and only if there is at least one flower that is chosen in the first way and not chosen in the second way.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.