#677
Unrated
Activating Robots
시간 제한
2s
메모리 제한
1024MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

You and a single robot are initially at point 00 on a circle with perimeter LL (1L1091 \le L \le 10^9). You can move either counterclockwise or clockwise along the circle at 11 unit per second. All movement in this problem is continuous.

Your goal is to place exactly R1R-1 robots such that at the end, every two consecutive robots are spaced L/RL/R away from each other (2R202\le R\le 20, RR divides LL). There are NN (1N1051\le N\le 10^5) activation points, the iith of which is located aia_i distance counterclockwise from 00 (0ai<L0\le a_i<L). If you are currently at an activation point, you can instantaneously place a robot at that point. All robots (including the original) move counterclockwise at a rate of 11 unit per KK seconds (1K1061\leq K\leq 10^6).

Compute the minimum time required to achieve the goal.

입력

The first line contains LL, RR, NN, and KK.

The next line contains NN space-separated integers a1,a2,,aNa_1,a_2,\dots,a_N.

출력

The minimum time required to achieve the goal.

예제 입력 1

10 2 1 2
6

예제 출력 1

22

예제 입력 2

10 2 1 2
7

예제 출력 2

4

예제 입력 3

32 4 5 2
0 23 12 5 11

예제 출력 3

48

예제 입력 4

24 3 1 2
16

예제 출력 4

48

점수

Inputs 5-6: R=2R=2Inputs 7-12: R10,N80R\le 10, N\le 80Inputs 13-20: R16R\le 16Inputs 21-24: No additional constraints.

코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.