欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

Codeforces Round #261 (Div. 2)B. Pashmak and Flowers(容易)

程序员文章站 2022-06-02 11:06:42
...

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 are n flowers in the garden and the i-th of them has a beauty number bi. 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.