## 【优先队列/贪心】The Average

In a speech contest, when a contestant finishes his speech, the judges will then grade his performance. The staff remove the highest grade and the lowest grade and compute the average of the rest as the contestant’s final grade. This is an easy problem because usually there are only several judges.

Let’s consider a generalized form of the problem above. Given n positive integers, remove the greatest n1 ones and the least n2 ones, and compute the average of the rest.

## 【贪心】小A与204

aiai为序列中第ii个数，你需要重新排列这个数列，使得ni=1(aiai1)2最大(公式的含义是：每个数与前一个数差的平方的和)

## Codeforces-1029A Many Equal Substrings

You are given a string t consisting of n lowercase Latin letters and an integer number k.Let’s define a substring of some string  with indices from  to r as .
Your task is to construct such string s of minimum possible length that there are exactly k positions i such that . In other words, your task is to construct such string s of minimum possible length that there are exactly k substrings of s equal to .It is guaranteed that the answer is always unique.

## Codeforces-1000B B Light It Up

Recently, you bought a brand new smart lamp with programming features. At first, you set up a schedule to the lamp. Every day it will turn power on at moment 0 and turn power off at moment M. Moreover, the lamp allows you to set a program of switching its state (states are “lights on” and “lights off”). Unfortunately, some program is already installed into the lamp.