A. Olympiad

Codeforces
IDCF937A
Time1000ms
Memory256MB
Difficulty
implementationsortings
English · Original
Chinese · Translation
Formal · Original
The recent All-Berland Olympiad in Informatics featured _n_ participants with each scoring a certain amount of points. As the head of the programming committee, you are to determine the set of participants to be awarded with diplomas with respect to the following criteria: * At least one participant should get a diploma. * None of those with score equal to zero should get awarded. * When someone is awarded, all participants with score **not less** than his score should also be awarded. Determine the number of ways to choose a subset of participants that will receive the diplomas. ## Input The first line contains a single integer _n_ (1 ≤ _n_ ≤ 100) — the number of participants. The next line contains a sequence of _n_ integers _a_1, _a_2, ..., _a__n_ (0 ≤ _a__i_ ≤ 600) — participants' scores. It's guaranteed that at least one participant has non-zero score. ## Output Print a single integer — the desired number of ways. [samples] ## Note There are three ways to choose a subset in sample case one. 1. Only participants with 3 points will get diplomas. 2. Participants with 2 or 3 points will get diplomas. 3. Everyone will get a diploma! The only option in sample case two is to award everyone. Note that in sample case three participants with zero scores cannot get anything.
最近的全俄罗斯信息学奥林匹克竞赛有 #cf_span[n] 名参赛者,每人获得一定的分数。 作为编程委员会主席,你需要根据以下标准确定授予奖状的参赛者集合: 计算选择获得奖状的参赛者子集的方式数。 第一行包含一个整数 #cf_span[n] (#cf_span[1 ≤ n ≤ 100]) —— 参赛者人数。 第二行包含一个包含 #cf_span[n] 个整数的序列 #cf_span[a1, a2, ..., an] (#cf_span[0 ≤ ai ≤ 600]) —— 参赛者的分数。 保证至少有一名参赛者的分数非零。 请输出一个整数 —— 所需的方式数。 在第一个样例中,有三种选择子集的方式。 第二个样例中唯一的选项是授予所有人。 注意:在第三个样例中,分数为零的参赛者无法获得任何奖状。 ## Input 第一行包含一个整数 #cf_span[n] (#cf_span[1 ≤ n ≤ 100]) —— 参赛者人数。第二行包含一个包含 #cf_span[n] 个整数的序列 #cf_span[a1, a2, ..., an] (#cf_span[0 ≤ ai ≤ 600]) —— 参赛者的分数。保证至少有一名参赛者的分数非零。 ## Output 请输出一个整数 —— 所需的方式数。 [samples] ## Note 在第一个样例中,有三种选择子集的方式:仅授予得 3 分的参赛者;授予得 2 分或 3 分的参赛者;授予所有人。第二个样例中唯一的选项是授予所有人。注意:在第三个样例中,分数为零的参赛者无法获得任何奖状。
**Definitions** Let $ n \in \mathbb{Z} $ be the number of participants. Let $ A = (a_1, a_2, \dots, a_n) $ be a sequence of non-negative integers representing participants' scores, with $ \max(A) > 0 $. Let $ M = \max(A) $ be the maximum score. **Constraints** 1. $ 1 \leq n \leq 100 $ 2. $ 0 \leq a_i \leq 600 $ for all $ i \in \{1, \dots, n\} $ 3. $ M > 0 $ **Objective** Count the number of non-empty subsets $ S \subseteq \{1, \dots, n\} $ such that: $$ \forall i \in S,\ a_i = M $$ That is, only participants with the maximum score may be awarded, and at least one such participant must be selected. Let $ k = |\{ i \mid a_i = M \}| $. Then the number of valid subsets is: $$ 2^k - 1 $$
Samples
Input #1
4
1 3 3 2
Output #1
3
Input #2
3
1 1 1
Output #2
1
Input #3
4
42 0 0 42
Output #3
1
API Response (JSON)
{
  "problem": {
    "name": "A. Olympiad",
    "description": {
      "content": "The recent All-Berland Olympiad in Informatics featured _n_ participants with each scoring a certain amount of points. As the head of the programming committee, you are to determine the set of partic",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF937A"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "The recent All-Berland Olympiad in Informatics featured _n_ participants with each scoring a certain amount of points.\n\nAs the head of the programming committee, you are to determine the set of partic...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "最近的全俄罗斯信息学奥林匹克竞赛有 #cf_span[n] 名参赛者,每人获得一定的分数。\n\n作为编程委员会主席,你需要根据以下标准确定授予奖状的参赛者集合:\n\n计算选择获得奖状的参赛者子集的方式数。\n\n第一行包含一个整数 #cf_span[n] (#cf_span[1 ≤ n ≤ 100]) —— 参赛者人数。\n\n第二行包含一个包含 #cf_span[n] 个整数的序列 #cf_span[a1,...",
      "is_translate": true,
      "language": "Chinese"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n \\in \\mathbb{Z} $ be the number of participants.  \nLet $ A = (a_1, a_2, \\dots, a_n) $ be a sequence of non-negative integers representing participants' scores, with $ \\max(A) ...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments