#P15196. [SWERC 2018] City of Lights

[SWERC 2018] City of Lights

题目描述

Paris has been called “ville lumière” (city of lights) since the 17th century. It earned this nickname in part because of the many city lights illuminating famous sites such as monuments, statues, churches, or fountains.

Those public lights in Paris are numbered from 11 to NN and are all on by default. A group of hackers has gained the capability to toggle groups of lights. Every time the hackers use their program, they cause a number ii (that they cannot control) to be sent to the system controlling the city lights. The lights numbered ii, 2i2i, 3i3i, and so on (up to NN) then change state instantly: lights that were on go off, and lights that were off go on.

During the night, the hackers use their programs kk times. What is the greatest number of lights that are simultaneously off at the same time?

输入格式

The input comprises several lines, each consisting of a single integer:

  • The first line contains the number NN of lights.
  • The second line contains the number kk of uses hackers’s program.
  • The next kk lines contain a number ii sent to the system controlling the lights.

输出格式

The output should consist of a single line, whose content is an integer, the greatest number of lights that are simultaneously off at the same time.

10
4
6
2
1
3
6

提示

Sample Explanation

We start with a group of 10 lights which are all on.

The hackers send the number 6: light 6 is toggled.

They then send the number 2: lights 2, 4, 6, 8, and 10 are toggled.

The number 1 is then sent: all lights are toggled.

They end up sending the number 3: lights 3, 6, and 9 are toggled.

The maximum number of lights off at the same time was 6.

:::align{center} :::

Limits

  • 1N10000001 \leq N \leq 1\,000\,000;
  • 1k1001 \leq k \leq 100;
  • 1iN1 \leq i \leq N.