問題一覧 > 通常問題

No.1946 Locker Problem

レベル : / AI推定難易度 : 850 / 実行時間制限 : 1ケース 3.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 157
作問者 : H20 / テスター : 蜜蜂 platinum
お気に入りにしたユーザー ProblemId : 7890 / 自分の提出
問題文最終更新日: 2022-05-05 18:06:54
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 344 (順位表) の他の問題:

Problem Statement

A school has $N$ students and $N$ lockers numbered from $1$ to $N$.

All the lockers are initially closed.

The $N$ students were instructed to operate the lockers one at a time, in order, according to the following rule.

Rule: The $i$-th student, for each locker whose number is a divisor of $i$, closes it if it is open and opens it if it is closed.

However, it has been reported that some students may have skipped out and not performed any operation at all.

After the operations of the $N$ students were completed, the number of open lockers was $M$, and the numbers of the open lockers were $A_1, A_2, \ldots, A_M$.

The number of students who skipped out is uniquely determined from the numbers of the open lockers. Output the number of students who skipped out.

Input

$N\ M$
$A_1$ $A_2$ $\ldots$ $A_M$

Constraints

  • $ 1 \le N \le 2\times10^{5}$
  • $ 0 \le M \le N$
  • $ 1 \le A_i \le N$
  • $A_1 \lt A_2 \lt \ldots \lt A_M$
  • All inputs are integers.

Output

Output the number of students who skipped out.
Print a newline at the end.

Sample

Sample 1
Input
6 3
1 2 5
Output
3

The $3$-rd, $4$-th, and $6$-th students skipped out. The open lockers change as follows.
Open lockers after the operation of student $1$: $1$
Open lockers after the operation of student $2$: $2$
Open lockers after the operation of student $5$: $1,2,5$

Sample 2
Input
10 5
2 4 5 8 9
Output
6

It seems that the $1$-st, $2$-nd, $4$-th, $6$-th, $7$-th, and $10$-th students skipped out.

Sample 3
Input
200000 0
            
Output
200000

It seems that all of the students skipped out.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。