포럼
문제 ICPC00277

E. Eavesdropper Evasion

설명

Alice wants to send \(n\) messages to Bob over a communication channel. The \(i\)th message takes \(t_i\) time steps to send. At each integer time step, Alice can start sending any number of her messages. Once started, a message must be transmitted in its entirety (it cannot be paused and resumed later). Any number of messages can be sent in parallel over the channel without affecting the transmission time of individual messages.

An attacker has the capability to disable the security protocols of the channel for an interval of \(x\) continuous time steps, but only once (i.e., after doing this, they cannot wait a while and then disable it for another \(x\) time steps). While the security is disabled, the attacker is able to listen in, and any message that is sent in its entirety during those \(x\) time steps is considered exposed.

What is the minimum time needed for Alice to send all \(n\) messages to Bob so that at most two messages are exposed, no matter when the attacker chooses to disable the security?

제약
입력 형식

The first line of input contains the two integers \(n\) and \(x\) (\(1 \leq n \leq 20\,000\), \(1 \leq x \leq 10\,000\)), the number of messages Alice wants to send and the number of time steps someone may listen in. This is followed by a line containing \(n\) integers \(t_1, \ldots, t_n\) (\(1 \leq t_i \leq 10\,000\)), the number of time steps it takes to transmit each message.

출력 형식

Output the minimum number of time steps to complete transmission of all \(n\) messages so that at most two of them can be exposed.

예제 1
입력
6 10
2 3 4 5 6 7
출력
16
예제 2
입력
7 6
9 3 2 3 8 3 3
출력
11
문제 정보

생성자가 기록되지 않았습니다.

출처 ICPC NCPC 2021

평가 및 의견

E. Eavesdropper Evasion

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 1 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

E. Eavesdropper Evasion

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8