CF432A.Choosing Teams

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

The Saratov State University Olympiad Programmers Training Center (SSU OPTC) has nn students. For each student you know the number of times he/she has participated in the ACM ICPC world programming championship. According to the ACM ICPC rules, each person can participate in the world championship at most 5 times.

The head of the SSU OPTC is recently gathering teams to participate in the world championship. Each team must consist of exactly three people, at that, any person cannot be a member of two or more teams. What maximum number of teams can the head make if he wants each team to participate in the world championship with the same members at least kk times?

输入格式

The first line contains two integers, nn and kk (1<=n<=2000; 1<=k<=5)(1<=n<=2000; 1<=k<=5) . The next line contains nn integers: y1,y2,...,yny_{1},y_{2},...,y_{n} (0<=yi<=5)(0<=y_{i}<=5) , where yiy_{i} shows the number of times the ii -th person participated in the ACM ICPC world championship.

输出格式

Print a single number — the answer to the problem.

输入输出样例

  • 输入#1

    5 2
    0 4 5 1 0
    

    输出#1

    1
    
  • 输入#2

    6 4
    0 1 2 3 4 5
    

    输出#2

    0
    
  • 输入#3

    6 5
    0 0 0 0 0 0
    

    输出#3

    2
    

说明/提示

In the first sample only one team could be made: the first, the fourth and the fifth participants.

In the second sample no teams could be created.

In the third sample two teams could be created. Any partition into two teams fits.

首页