QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 1024 MB 満点: 100 ハック可能 ✓

#18453. ヒストグラム列 4

統計

あなたは、$N$ 個の軸に平行な長方形が共通の底辺を共有して並んでいるヒストグラムを持っていました。左から $i$ 番目の長方形は幅が $1$ で、高さは整数 $H_i$ です。

残念なことに、あなたはそのヒストグラムを失くしてしまいました!さらに、ヒストグラムがどのような形をしていたか、つまり各長方形の高さも忘れてしまいました。あなたが覚えているのは、ヒストグラムに含まれる軸に平行な長方形の最大面積 $A$ と、すべての $H_i$ について $L \le H_i \le R$ が成り立つという事実だけです。

あなたの目標は、覚えているすべての条件を満たすヒストグラムを一つ見つけることで、ヒストグラムを復元することです。記憶が完全ではない可能性があるため、条件を満たすヒストグラムが存在しない場合もあります。

入力

入力は以下の形式で与えられる。

$N$ $A$ $L$ $R$

出力

条件を満たすヒストグラムが存在しない場合は NO と出力せよ。 存在する場合は、1行目に YES と出力せよ。2行目に、各長方形の高さ $H_i$ を表す $N$ 個の整数を空白区切りで出力せよ。答えが複数存在する場合は、そのうちのどれを出力してもよい。

制約

  • $1 \le N \le 500\,000$
  • $0 \le A \le 10^{18}$
  • $0 \le L \le R \le 10^{18}$

入出力例

入力 1

6 25 2 10

出力 1

YES
3 7 6 8 5 5

入力 2

1 0 1000000000000000000

出力 2

YES
0

入力 3

1 8213912883 0 28318

出力 3

NO

注記

高さが $3, 7, 6, 8, 5, 5$ であるヒストグラムを以下に示す。このヒストグラムに含まれる最大面積の長方形の面積は $25$ である。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.