CF432A.Choosing Teams

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

The Saratov State University Olympiad Programmers Training Center (SSU OPTC) has n 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 k times?

萨拉托夫国立大学奥林匹克程序员培训中心(SSU OPTC)共有 nn 名学生。对于每名学生,已知其参加 ACM ICPC 世界编程锦标赛的次数。根据 ACM ICPC 规则,每人最多可参加世界锦标赛 55 次。

SSU OPTC 的负责人最近正在组建队伍以参加世界锦标赛。每支队伍必须恰好由三人组成,且任何人不能同时属于两支或更多队伍。如果负责人希望每支队伍以完全相同的成员至少参加 kk 次世界锦标赛,那么他最多能组建多少支队伍?

输入格式

The first line contains two integers, n and k (1 ≤ n ≤ 2000; 1 ≤ k ≤ 5). The next line contains n integers: _y_1, _y_2, ..., y__n (0 ≤ y__i ≤ 5), where y__i shows the number of times the i-th person participated in the ACM ICPC world championship.

第一行包含两个整数 nn 和 kk(1≤n≤20001 \leq n \leq 2000;1≤k≤51 \leq k \leq 5)。
第二行包含 nn 个整数:y1, y2, …, yny_1,\ y_2,\ \dots,\ y_n(0≤yi≤50 \leq y_i \leq 5),其中 yiy_i 表示第 ii 个人参加 ACM ICPC 世界总决赛的次数。

输出格式

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.

在第一个样例中,只能组成一支队伍:由第一、第四和第五名参与者组成。

在第二个样例中,无法组成任何队伍。

在第三个样例中,可以组成两支队伍。任意划分为两支队伍的方案均满足要求。

输入解题思路,AI测评打分。不知道怎么写?

首页